Skip to contentSkip to conversation

spice: fix memory leak

PATCH In review Gerd Hoffmann 2 participants 2 messages Feb 11, 2015 – Feb 12, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 spice: fix memory leak

Found by coverity.

---
 monitor.c | 1 +
 1 file changed, 1 insertion(+)
monitor.c +1 -0
index c3cc060..2c37953 100644
@@ -1101,6 +1101,7 @@ static int client_migrate_info(Monitor *mon, const QDict *qdict,
     if (strcmp(protocol, "spice") == 0) {
         if (!qemu_using_spice(&err)) {
             qerror_report_err(err);
+            error_free(err);
             return -1;
         }
 
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 14 lines · Gerd Hoffmann

Found by coverity.

---
 monitor.c | 1 +
 1 file changed, 1 insertion(+)
monitor.c +0 -0
index c3cc060..2c37953 100644

monitor.c static int client_migrate_info(Monitor *mon, const QDict *qdict, · line 1107

Quoted 7 lines
monitor.c +1 -0
@@ -1101,6 +1101,7 @@ static int client_migrate_info(Monitor *mon, const QDict *qdict,
     if (strcmp(protocol, "spice") == 0) {
         if (!qemu_using_spice(&err)) {
             qerror_report_err(err);
+            error_free(err);
             return -1;
         }
 

Hi, Gerd
the err variable should be initialized to NULL.

This leak had been fixed by:
http://patchwork.ozlabs.org/patch/438696/

and v2:
[PATCH v2] monitor: Fix missing err = NULL in client_migrate_info()

Regards,
-Gonglei