girepository/girparser: Free the temporary context modules list when done

When we're about to return the found module we can just drop the list
of modules that we had previously copied in the temporary context
This commit is contained in:
Marco Trevisan (Treviño) 2024-05-10 18:14:38 +02:00 committed by Philip Withnall
parent b59c3f73ee
commit 23d3a5e859

View File

@ -3819,6 +3819,7 @@ gi_ir_parser_parse_string (GIIrParser *parser,
g_clear_pointer (&ctx.aliases, g_hash_table_unref);
g_clear_pointer (&ctx.disguised_structures, g_hash_table_unref);
g_clear_pointer (&ctx.pointer_structures, g_hash_table_unref);
g_clear_list (&ctx.modules, (GDestroyNotify) gi_ir_module_free);
g_list_free (ctx.include_modules);
}
@ -3827,7 +3828,12 @@ gi_ir_parser_parse_string (GIIrParser *parser,
g_markup_parse_context_free (context);
if (ctx.modules)
return ctx.modules->data;
{
GIIrModule *module = ctx.modules->data;
g_clear_list (&ctx.modules, NULL);
return module;
}
if (error && *error == NULL)
g_set_error (error,