From a3e8a3f382363d5fd452cfc15f90a688d70023d9 Mon Sep 17 00:00:00 2001 From: Yang Hongyang Date: Tue, 20 Oct 2015 09:51:26 +0800 Subject: [PATCH] net: free the string returned by object_get_canonical_path_component The value returned from object_get_canonical_path_component must be freed. Signed-off-by: Yang Hongyang Cc: Jason Wang Cc: Paolo Bonzini Signed-off-by: Jason Wang --- net/net.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/net.c b/net/net.c index 2f2b39e09b..a3e9d1a9b3 100644 --- a/net/net.c +++ b/net/net.c @@ -1197,10 +1197,11 @@ void print_net_client(Monitor *mon, NetClientState *nc) monitor_printf(mon, "filters:\n"); } QTAILQ_FOREACH(nf, &nc->filters, next) { - monitor_printf(mon, " - %s: type=%s%s\n", - object_get_canonical_path_component(OBJECT(nf)), + char *path = object_get_canonical_path_component(OBJECT(nf)); + monitor_printf(mon, " - %s: type=%s%s\n", path, object_get_typename(OBJECT(nf)), nf->info_str); + g_free(path); } }