]> xenbits.xensource.com Git - libvirt.git/commitdiff
virshEventPrint: Use automatic memory clearing
authorPeter Krempa <pkrempa@redhat.com>
Thu, 27 Jan 2022 12:54:57 +0000 (13:54 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 3 Mar 2022 10:06:56 +0000 (11:06 +0100)
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tools/virsh-domain.c

index 25097627ac63b897a9d5f7d5b7d19e64a349d90f..33984618ebe8be668292d76a789f5fded607a384 100644 (file)
@@ -13166,13 +13166,13 @@ static void
 virshEventPrint(virshDomEventData *data,
                 virBuffer *buf)
 {
-    char *msg;
+    g_autofree char *msg = NULL;
 
     if (!(msg = virBufferContentAndReset(buf)))
         return;
 
     if (!data->loop && *data->count)
-        goto cleanup;
+        return;
 
     if (data->timestamp) {
         char timestamp[VIR_TIME_STRING_BUFLEN];
@@ -13188,9 +13188,6 @@ virshEventPrint(virshDomEventData *data,
     (*data->count)++;
     if (!data->loop)
         vshEventDone(data->ctl);
-
- cleanup:
-    VIR_FREE(msg);
 }
 
 static void