aboutsummaryrefslogtreecommitdiff
path: root/dump
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2023-10-31 11:45:28 +0100
committerMarc-André Lureau <marcandre.lureau@redhat.com>2023-11-02 18:40:50 +0400
commit96afbc571c91b115ba51d9740352a0e45111edc9 (patch)
tree784eb7c263ac29eb2efaba145ce55082b83969fc /dump
parent8beaeed73496395f75a3e65191d45e0e299fb25b (diff)
dump: Fix g_array_unref(NULL) in dump-guest-memory
When dump_init()'s check for non-zero @length fails, dump_cleanup() passes null s->string_table_buf to g_array_unref(), which spews "GLib: g_array_unref: assertion 'array' failed" to stderr. Guard the g_array_unref(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20231031104531.3169721-3-armbru@redhat.com>
Diffstat (limited to 'dump')
-rw-r--r--dump/dump.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/dump/dump.c b/dump/dump.c
index 9cdb4a2bf8..24c829e705 100644
--- a/dump/dump.c
+++ b/dump/dump.c
@@ -100,7 +100,7 @@ static int dump_cleanup(DumpState *s)
memory_mapping_list_free(&s->list);
close(s->fd);
g_free(s->guest_note);
- g_array_unref(s->string_table_buf);
+ g_clear_pointer(&s->string_table_buf, g_array_unref);
s->guest_note = NULL;
if (s->resume) {
if (s->detached) {