From b347a44e5ed4303ba98e738ba1b372d708ba5b55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 11 Aug 2023 00:42:10 +0200 Subject: [PATCH] gdump: Do not overwrite GError contents In case of multiple IO failures we may try to use a GError multiple times, avoid so. See: https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/411#note_1812951 --- gdump.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/gdump.c b/gdump.c index 449b260a4..c63dc4556 100644 --- a/gdump.c +++ b/gdump.c @@ -669,14 +669,11 @@ g_irepository_dump (const char *arg, GError **error) goutput_write (G_OUTPUT_STREAM (output), "\n"); { - GError **ioerror; /* Avoid overwriting an earlier set error */ - if (caught_error) - ioerror = NULL; - else - ioerror = error; - caught_error |= !g_input_stream_close (G_INPUT_STREAM (in), NULL, ioerror); - caught_error |= !g_output_stream_close (G_OUTPUT_STREAM (output), NULL, ioerror); + caught_error |= !g_input_stream_close (G_INPUT_STREAM (in), NULL, + caught_error ? NULL : error); + caught_error |= !g_output_stream_close (G_OUTPUT_STREAM (output), NULL, + caught_error ? NULL : error); } g_object_unref (in);