]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: don't call virSecretFree on NULL
authorJán Tomko <jtomko@redhat.com>
Fri, 29 Mar 2013 11:55:38 +0000 (12:55 +0100)
committerJán Tomko <jtomko@redhat.com>
Thu, 9 May 2013 13:54:08 +0000 (15:54 +0200)
Since the refactoring in fbe2d49 we call virSecretFree even if
virSecretDefineXML fails, which leads to overwriting the error
message with:
error: Invalid secret: virSecretFree

Bug: https://bugzilla.redhat.com/show_bug.cgi?id=929045
(cherry picked from commit bfb4b822579ce1afcbc396fe4bc3b57fb3ebc150)

tools/virsh-secret.c

index 6329110e2390936717105ed587d63a28fb66c4df..9d8d241954b05d7e31cdd2bb593639c63c9f7de7 100644 (file)
@@ -117,7 +117,8 @@ cmdSecretDefine(vshControl *ctl, const vshCmd *cmd)
 
 cleanup:
     VIR_FREE(buffer);
-    virSecretFree(res);
+    if (res)
+        virSecretFree(res);
     return ret;
 }