6ae9ed
From 9fccff47a561ba773a94dbf18e266771d674ca47 Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <9fccff47a561ba773a94dbf18e266771d674ca47@dist-git>
6ae9ed
From: John Ferlan <jferlan@redhat.com>
6ae9ed
Date: Mon, 15 Aug 2016 10:12:15 -0400
6ae9ed
Subject: [PATCH] virsh: Fix core for cmdSecretGetValue
6ae9ed
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1366611
6ae9ed
6ae9ed
When commit id 'cb2e3e50' reworked the cmdSecretGetValue call to use
6ae9ed
VIR_DISPOSE_STRING for base64, it neglected to initialize the base64
6ae9ed
value to NULL since the cleanup: label could be reached prior to the
6ae9ed
base64 value being set or not.  This resulted in a core dump, adding
6ae9ed
the initialization will avoid the issue.
6ae9ed
6ae9ed
(cherry picked from commit 18701e9d6213be5a622d7c797f3a899b689e26b2)
6ae9ed
Signed-off-by: John Ferlan <jferlan@redhat.com>
6ae9ed
---
6ae9ed
 tools/virsh-secret.c | 2 +-
6ae9ed
 1 file changed, 1 insertion(+), 1 deletion(-)
6ae9ed
6ae9ed
diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c
6ae9ed
index 8588f4c..537bdd7 100644
6ae9ed
--- a/tools/virsh-secret.c
6ae9ed
+++ b/tools/virsh-secret.c
6ae9ed
@@ -253,7 +253,7 @@ static bool
6ae9ed
 cmdSecretGetValue(vshControl *ctl, const vshCmd *cmd)
6ae9ed
 {
6ae9ed
     virSecretPtr secret;
6ae9ed
-    char *base64;
6ae9ed
+    char *base64 = NULL;
6ae9ed
     unsigned char *value;
6ae9ed
     size_t value_size;
6ae9ed
     bool ret = false;
6ae9ed
-- 
6ae9ed
2.9.2
6ae9ed