]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: Fix core for cmdSecretGetValue
authorJohn Ferlan <jferlan@redhat.com>
Mon, 15 Aug 2016 11:53:45 +0000 (07:53 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 15 Aug 2016 11:53:45 +0000 (07:53 -0400)
https://bugzilla.redhat.com/show_bug.cgi?id=1366611

When commit id 'cb2e3e50' reworked the cmdSecretGetValue call to use
VIR_DISPOSE_STRING for base64, it neglected to initialize the base64
value to NULL since the cleanup: label could be reached prior to the
base64 value being set or not.  This resulted in a core dump, adding
the initialization will avoid the issue.

tools/virsh-secret.c

index 8588f4cc2a54fd1cff35761f0957e5fc6c71b6ed..537bdd7b1864b033942c67f928e2ab4a207527f6 100644 (file)
@@ -253,7 +253,7 @@ static bool
 cmdSecretGetValue(vshControl *ctl, const vshCmd *cmd)
 {
     virSecretPtr secret;
-    char *base64;
+    char *base64 = NULL;
     unsigned char *value;
     size_t value_size;
     bool ret = false;