OSDN Git Service

net: free the string returned by object_get_canonical_path_component
authorYang Hongyang <yanghy@cn.fujitsu.com>
Tue, 20 Oct 2015 01:51:26 +0000 (09:51 +0800)
committerJason Wang <jasowang@redhat.com>
Tue, 27 Oct 2015 02:30:42 +0000 (10:30 +0800)
The value returned from object_get_canonical_path_component
must be freed.

Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
net/net.c

index 2f2b39e..a3e9d1a 100644 (file)
--- 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);
     }
 }