[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 5/8] dump: Fix g_array_unref(NULL) in dump-guest-memory
|
From: |
marcandre . lureau |
|
Subject: |
[PULL 5/8] dump: Fix g_array_unref(NULL) in dump-guest-memory |
|
Date: |
Fri, 3 Nov 2023 11:01:33 +0400 |
From: Markus Armbruster <armbru@redhat.com>
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>
---
dump/dump.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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) {
--
2.41.0
- [PULL 0/8] Dump patches, marcandre . lureau, 2023/11/03
- [PULL 4/8] dump: Rename qmp_dump_guest_memory() parameter to match QAPI schema, marcandre . lureau, 2023/11/03
- [PULL 5/8] dump: Fix g_array_unref(NULL) in dump-guest-memory,
marcandre . lureau <=
- [PULL 6/8] dump: Recognize "fd:" protocols on Windows hosts, marcandre . lureau, 2023/11/03
- [PULL 8/8] dump: Drop redundant check for empty dump, marcandre . lureau, 2023/11/03
- [PULL 7/8] dump: Improve some dump-guest-memory error messages, marcandre . lureau, 2023/11/03
- Re: [PULL 0/8] Dump patches, Stefan Hajnoczi, 2023/11/06