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

[libvirt] [PATCH] util: don't free dmidecode path string before printing it



The path was freed before printing the error message, resulting in:
error : virSysinfoRead:773 : internal error Failed to execute command
(null)
---
 src/util/sysinfo.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/util/sysinfo.c b/src/util/sysinfo.c
index 92c3539..8ecd1e3 100644
--- a/src/util/sysinfo.c
+++ b/src/util/sysinfo.c
@@ -765,7 +765,6 @@ virSysinfoRead(void) {
     }
 
     cmd = virCommandNewArgList(path, "-q", "-t", "0,1,4,17", NULL);
-    VIR_FREE(path);
     virCommandSetOutputBuffer(cmd, &outbuf);
     if (virCommandRun(cmd, NULL) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -796,6 +795,7 @@ virSysinfoRead(void) {
         goto no_memory;
 
 cleanup:
+    VIR_FREE(path);
     VIR_FREE(outbuf);
     virCommandFree(cmd);
 
-- 
1.7.8.6


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