[PATCHv2 1/1] qemu_agent.c: Use g_autofree in qemu_agent.c

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

 



This is the only instance of g_autofree change applicable for
qemu_agent.c

Signed-off-by: Seeteena Thoufeek <s1seetee@xxxxxxxxxxxxxxxxxx>
---
 src/qemu/qemu_agent.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 95a7d9b..d7fcc86 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -332,9 +332,8 @@ static int qemuAgentIOProcessData(qemuAgentPtr agent,
     size_t i = 0;
 #if DEBUG_IO
 # if DEBUG_RAW_IO
-    char *str1 = qemuAgentEscapeNonPrintable(data);
+    g_autofree char *str1 = qemuAgentEscapeNonPrintable(data);
     VIR_ERROR(_("[%s]"), str1);
-    VIR_FREE(str1);
 # else
     VIR_DEBUG("Data %zu bytes [%s]", len, data);
 # endif
@@ -377,12 +376,10 @@ qemuAgentIOProcess(qemuAgentPtr agent)
 
 #if DEBUG_IO
 # if DEBUG_RAW_IO
-    char *str1 = qemuAgentEscapeNonPrintable(msg ? msg->txBuffer : "");
-    char *str2 = qemuAgentEscapeNonPrintable(agent->buffer);
+    g_autofree char *str1 = qemuAgentEscapeNonPrintable(msg ? msg->txBuffer : "");
+    g_autofree char *str2 = qemuAgentEscapeNonPrintable(agent->buffer);
     VIR_ERROR(_("Process %zu %p %p [[[%s]]][[[%s]]]"),
               agent->bufferOffset, agent->msg, msg, str1, str2);
-    VIR_FREE(str1);
-    VIR_FREE(str2);
 # else
     VIR_DEBUG("Process %zu", agent->bufferOffset);
 # endif
@@ -1083,7 +1080,7 @@ qemuAgentCommandFull(qemuAgentPtr agent,
 {
     int ret = -1;
     qemuAgentMessage msg;
-    char *cmdstr = NULL;
+    g_autofree char *cmdstr = NULL;
     int await_event = agent->await_event;
 
     *reply = NULL;
@@ -1133,7 +1130,6 @@ qemuAgentCommandFull(qemuAgentPtr agent,
     ret = qemuAgentCheckError(cmd, *reply, report_unsupported);
 
  cleanup:
-    VIR_FREE(cmdstr);
     VIR_FREE(msg.txBuffer);
     agent->await_event = QEMU_AGENT_EVENT_NONE;
 
-- 
1.8.3.1






[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux