girepository/compiler: Free the parser when not needed

The compiler code was full of leaks and nothing really checked on them.

While it's not a big deal per se, per the nature of it, it's still
better to ensure that memory management is well done so that there are
no problems when using it with sanitizers.

So, the source of the problems was not freeing the parser, but that
wasn't enough, more to come...
This commit is contained in:
Marco Trevisan (Treviño) 2024-05-10 17:24:49 +02:00 committed by Philip Withnall
parent 311367620a
commit 47cf6387ad

View File

@ -218,6 +218,7 @@ main (int argc, char **argv)
char *message = g_strdup_printf (_("Error parsing file %s: %s"), input[0], error->message);
g_fprintf (stderr, "%s\n", message);
g_free (message);
gi_ir_parser_free (parser);
return 1;
}
@ -253,10 +254,7 @@ main (int argc, char **argv)
g_debug ("[building] done");
#if 0
/* No point */
gi_ir_parser_free (parser);
#endif
return 0;
}