[gimp] libgimpbase: GError set twice in gimpreloc.c



commit f87ec4bcfeb3584f83949f80dd81d8b621cdbfbd
Author: Lukas Oberhuber <lukaso gmail com>
Date:   Sun Oct 3 00:29:15 2021 +0000

    libgimpbase: GError set twice in gimpreloc.c
    
    This patch fixes a double free error due to a pointer being freed and
    then not nulled out.
    It appears this is corrupting memory on MacOS as the `/proc` file system
    is not available and therefore multiple errors are returned.
    
    Fixes:
    
    (process:54873): GLib-WARNING **: 23:09:25.976: GError set over the top of
    a previous GError or uninitialized memory.
    This indicates a bug in someone's code. You must ensure an error is NULL
    before it's set.
    The overwriting error message was: Error opening file /proc/self/maps: No
    such file or directory
    _br_find_exe: (NULL)gimp-console(54873,0x100957e00) malloc: *** error for
    object 0x103f09e80: pointer being freed was not allocated
    gimp-console(54873,0x100957e00) malloc: *** set a breakpoint in
    malloc_error_break to debug

 libgimpbase/gimpreloc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/libgimpbase/gimpreloc.c b/libgimpbase/gimpreloc.c
index 24ca09c185..c2e9eed879 100644
--- a/libgimpbase/gimpreloc.c
+++ b/libgimpbase/gimpreloc.c
@@ -73,7 +73,7 @@ _br_find_exe (GimpBinrelocInitError *error)
            * an alternate method.
            */
           g_printerr ("%s: %s\n", G_STRFUNC, gerror->message);
-          g_error_free (gerror);
+          g_clear_error (&gerror);
 
           break;
         }
@@ -107,7 +107,7 @@ _br_find_exe (GimpBinrelocInitError *error)
   if (! input)
     {
       g_printerr ("%s: %s", G_STRFUNC, gerror->message);
-      g_error_free (gerror);
+      g_clear_error (&gerror);
 
       if (error)
         *error = GIMP_RELOC_INIT_ERROR_OPEN_MAPS;


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