Skip to contentSkip to conversation

block: Fix memory leak in hmp_drive_add_node()

PATCH In review Kevin Wolf 2 participants 2 messages Mar 16, 2016

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 block: Fix memory leak in hmp_drive_add_node()

hmp_drive_add_node() leaked qdict in the error path when no node-name is specified.

---
 blockdev.c | 1 +
 1 file changed, 1 insertion(+)
blockdev.c +1 -0
index e7b8676..50410bf 100644
@@ -3898,6 +3898,7 @@ void hmp_drive_add_node(Monitor *mon, const char *optstr)
     qdict = qemu_opts_to_qdict(opts, NULL);
 
     if (!qdict_get_try_str(qdict, "node-name")) {
+        QDECREF(qdict);
         error_report("'node-name' needs to be specified");
         goto out;
     }
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Kevin Wolf

hmp_drive_add_node() leaked qdict in the error path when no node-name is specified.

---
 blockdev.c | 1 +
 1 file changed, 1 insertion(+)
blockdev.c +0 -0
index e7b8676..50410bf 100644

blockdev.c void hmp_drive_add_node(Monitor *mon, const char *optstr) · line 3904

Quoted 7 lines
blockdev.c +1 -0
@@ -3898,6 +3898,7 @@ void hmp_drive_add_node(Monitor *mon, const char *optstr)
     qdict = qemu_opts_to_qdict(opts, NULL);
 
     if (!qdict_get_try_str(qdict, "node-name")) {
+        QDECREF(qdict);
         error_report("'node-name' needs to be specified");
         goto out;
     }