diff options
author | Chen Fan <chen.fan.fnst@cn.fujitsu.com> | 2014-08-18 14:46:34 +0800 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2014-09-02 22:38:16 +0400 |
commit | 976620ac4018db142d82cd42bb7774f40290ce7e (patch) | |
tree | 2e3a3c21cd37c580b50e98b84cb94059ee1f222a /hmp.c | |
parent | b0e90181e4d7244a9466447703acdb2cdd7abdaa (diff) |
qom/object.c, hmp.c: fix string_output_get_string() memory leak
string_output_get_string() uses g_string_free(str, false) to
transfer the 'str' pointer to callers and never free it.
Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'hmp.c')
-rw-r--r-- | hmp.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1687,6 +1687,7 @@ void hmp_info_memdev(Monitor *mon, const QDict *qdict) MemdevList *memdev_list = qmp_query_memdev(&err); MemdevList *m = memdev_list; StringOutputVisitor *ov; + char *str; int i = 0; @@ -1704,9 +1705,10 @@ void hmp_info_memdev(Monitor *mon, const QDict *qdict) m->value->prealloc ? "true" : "false"); monitor_printf(mon, " policy: %s\n", HostMemPolicy_lookup[m->value->policy]); - monitor_printf(mon, " host nodes: %s\n", - string_output_get_string(ov)); + str = string_output_get_string(ov); + monitor_printf(mon, " host nodes: %s\n", str); + g_free(str); string_output_visitor_cleanup(ov); m = m->next; i++; |