From b50c7d452f5aef52cc9e7461f215cab87c3f3b03 Mon Sep 17 00:00:00 2001 From: Li Zhijian Date: Wed, 23 Dec 2015 15:43:19 +0800 Subject: [PATCH] net/dump: fix nfds->filename leak Cc: Jason Wang Signed-off-by: Li Zhijian Cc: qemu-stable@nongnu.org Signed-off-by: Jason Wang --- net/dump.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/dump.c b/net/dump.c index ce16a4b0e3..347b5ca334 100644 --- a/net/dump.c +++ b/net/dump.c @@ -329,6 +329,13 @@ static void filter_dump_instance_init(Object *obj) file_dump_set_filename, NULL); } +static void filter_dump_instance_finalize(Object *obj) +{ + NetFilterDumpState *nfds = FILTER_DUMP(obj); + + g_free(nfds->filename); +} + static void filter_dump_class_init(ObjectClass *oc, void *data) { NetFilterClass *nfc = NETFILTER_CLASS(oc); @@ -343,6 +350,7 @@ static const TypeInfo filter_dump_info = { .parent = TYPE_NETFILTER, .class_init = filter_dump_class_init, .instance_init = filter_dump_instance_init, + .instance_finalize = filter_dump_instance_finalize, .instance_size = sizeof(NetFilterDumpState), };