girepository/compiler: Cleanup the parser on write failures

This commit is contained in:
Marco Trevisan (Treviño) 2024-05-24 16:58:53 +02:00
parent 416bab52eb
commit cc070e1a7d

View File

@ -229,6 +229,7 @@ main (int argc, char **argv)
{ {
GITypelib *typelib = NULL; GITypelib *typelib = NULL;
int write_successful;
if (shlibs) if (shlibs)
{ {
@ -246,10 +247,14 @@ main (int argc, char **argv)
g_error (_("Invalid typelib for module %s: %s"), g_error (_("Invalid typelib for module %s: %s"),
module->name, error->message); module->name, error->message);
if (!write_out_typelib (NULL, typelib)) write_successful = write_out_typelib (NULL, typelib);
return 1;
g_clear_pointer (&typelib, gi_typelib_unref); g_clear_pointer (&typelib, gi_typelib_unref);
if (!write_successful)
{
gi_ir_parser_free (parser);
return 1;
}
} }
g_debug ("[building] done"); g_debug ("[building] done");