[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
diagnostics: fix memory leak in libtextstyle
From: |
Akim Demaille |
Subject: |
diagnostics: fix memory leak in libtextstyle |
Date: |
Thu, 18 Apr 2019 23:06:02 +0200 |
commit 79f7afb125445d71faba47e3cb1a55102a9a07a3
Author: Akim Demaille <address@hidden>
Date: Mon Apr 15 07:37:55 2019 +0200
diagnostics: fix memory leak in libtextstyle
* src/complain.h, src/complain.c (complain_free): New.
* src/main.c: Use it.
diff --git a/src/complain.c b/src/complain.c
index b0daa4a9..97af2f95 100644
--- a/src/complain.c
+++ b/src/complain.c
@@ -278,6 +278,12 @@ complain_init (void)
}
}
+void
+complain_free (void)
+{
+ caret_free ();
+ styled_ostream_free (errstream);
+}
/* A diagnostic with FLAGS is about to be issued. With what severity?
(severity_fatal, severity_error, severity_disabled, or
diff --git a/src/complain.h b/src/complain.h
index c136c071..199f388d 100644
--- a/src/complain.h
+++ b/src/complain.h
@@ -90,6 +90,9 @@ void warnings_argmatch (char *args);
/** Initialize this module. */
void complain_init (void);
+/** Reclaim resources. */
+void complain_free (void);
+
/** Initialize support for colored messages. */
void complain_init_color (void);
diff --git a/src/main.c b/src/main.c
index f0337b15..8b48ad27 100644
--- a/src/main.c
+++ b/src/main.c
@@ -234,8 +234,6 @@ main (int argc, char *argv[])
timevar_stop (tv_total);
timevar_print (stderr);
- caret_free ();
-
/* Fix input file now, even if there are errors: that's less
warnings in the following runs. */
if (!fixits_empty ())
@@ -249,5 +247,7 @@ main (int argc, char *argv[])
}
uniqstrs_free ();
+ complain_free ();
+
return complaint_status ? EXIT_FAILURE : EXIT_SUCCESS;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- diagnostics: fix memory leak in libtextstyle,
Akim Demaille <=