net/colo: fix g_hash_table_destroy assertion on uninitialized filter
colo_rewriter_cleanup() unconditionally destroys connection_track_table, but the table is only allocated in colo_rewriter_setup(). When the filter-rewriter object is finalized without having been set up (e.g. during qom-test property enumeration), the pointer is NULL and g_hash_table_destroy() fires an assertion. Use g_clear_pointer() to skip the destroy when the table was never initialized. Signed-off-by: Marc-Andre Lureau <marcandre.lureau@redhat.com> Reviewed-by: Zhang Chen <zhangckid@gmail.com> Message-ID: <20260709111315.1108185-1-marcandre.lureau@redhat.com>
Marc-André Lureau committed
Jul 9, 2026 at 15:13 UTC
b28778131fad008fcb79204874d926c2433e518f
1 file changed
+1
-1
net/filter-rewriter.c
+1
-1
@@ -373,7 +373,7 @@ static void colo_rewriter_cleanup(NetFilterState *nf)
373
g_free(s->incoming_queue);
374
}
375
376
- g_hash_table_destroy(s->connection_track_table);
376
+ g_clear_pointer(&s->connection_track_table, g_hash_table_destroy);
377
}
378
379
static void colo_rewriter_setup(NetFilterState *nf, Error **errp)