[glib: 1/2] glib-compile-resources: Fix a memory leak of the compiler option




commit a09aca68d47e8b5e761e3eeb43a97c35c923f429
Author: Philip Withnall <pwithnall endlessos org>
Date:   Thu Feb 17 21:18:27 2022 +0000

    glib-compile-resources: Fix a memory leak of the compiler option
    
    `G_OPTION_ARG_STRING` returns a newly allocated string, not a `const`
    one.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 gio/glib-compile-resources.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gio/glib-compile-resources.c b/gio/glib-compile-resources.c
index 306809a18..82f19563a 100644
--- a/gio/glib-compile-resources.c
+++ b/gio/glib-compile-resources.c
@@ -812,7 +812,7 @@ main (int argc, char **argv)
   char *c_name = NULL;
   char *c_name_no_underscores;
   const char *linkage = "extern";
-  const char *compiler = NULL;
+  char *compiler = NULL;
   CompilerType compiler_type = COMPILER_GCC;
   GOptionContext *context;
   GOptionEntry entries[] = {
@@ -886,6 +886,7 @@ main (int argc, char **argv)
     linkage = "G_GNUC_INTERNAL";
 
   compiler_type = get_compiler_id (compiler);
+  g_free (compiler);
 
   srcfile = argv[1];
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]