[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] fix memory leak in qemuMonitorJSONAttachCharDevCommand



The @tlsalias allocated in qemuAliasTLSObjFromSrcAlias may lost
 when append string to json.

Signed-off-by: Xi Xu <xu xi8 zte com cn>
---
 src/qemu/qemu_monitor_json.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index f208dd0..773de0f 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -6487,6 +6487,7 @@ qemuMonitorJSONAttachCharDevCommand(const char *chrID,
 
             if (virJSONValueObjectAppendString(data, "tls-creds", tlsalias) < 0)
                 goto error;
+            VIR_FREE(tlsalias);
         }
         break;
 
-- 
1.8.3.1



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]