From cc070e1a7dd2689fbbb8e11ee2e8d9f1cb5c65b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 24 May 2024 16:58:53 +0200 Subject: [PATCH] girepository/compiler: Cleanup the parser on write failures --- girepository/compiler/compiler.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/girepository/compiler/compiler.c b/girepository/compiler/compiler.c index e9b1b1563..31d855787 100644 --- a/girepository/compiler/compiler.c +++ b/girepository/compiler/compiler.c @@ -229,6 +229,7 @@ main (int argc, char **argv) { GITypelib *typelib = NULL; + int write_successful; if (shlibs) { @@ -246,10 +247,14 @@ main (int argc, char **argv) g_error (_("Invalid typelib for module ā€˜%s’: %s"), module->name, error->message); - if (!write_out_typelib (NULL, typelib)) - return 1; - + write_successful = write_out_typelib (NULL, typelib); g_clear_pointer (&typelib, gi_typelib_unref); + + if (!write_successful) + { + gi_ir_parser_free (parser); + return 1; + } } g_debug ("[building] done");