]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
rbd: Do not free the secret if it is not set
authorWido den Hollander <wido@widodh.nl>
Tue, 16 Jul 2013 12:26:07 +0000 (14:26 +0200)
committerJán Tomko <jtomko@redhat.com>
Thu, 1 Aug 2013 15:13:58 +0000 (17:13 +0200)
Not all RBD (Ceph) storage pools have cephx authentication turned on,
so "secret" might not be initialized.

It could also be that the secret couldn't be located.

Only call virSecretFree() if "secret" is initialized earlier.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
(cherry picked from commit d58c8478443d49c6e702bbb2c56a567ef23f036f)

src/storage/storage_backend_rbd.c

index e815192c22a014cbe85ee197b01219b3deb95b21..30d7cf2c944ee4f106aa27df5338e99b4df354ec 100644 (file)
@@ -176,7 +176,10 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr *ptr,
 cleanup:
     VIR_FREE(secret_value);
     VIR_FREE(rados_key);
-    virSecretFree(secret);
+
+    if (secret != NULL)
+        virSecretFree(secret);
+
     virBufferFreeAndReset(&mon_host);
     VIR_FREE(mon_buff);
     return ret;