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
This commit is contained in:
Lukas Oberhuber 2021-10-03 00:29:15 +00:00 committed by Jehan
parent d33c45fb47
commit f87ec4bcfe

View file

@ -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;