]> 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 14:58:00 +0000 (16:58 +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 953a8eefefe7e4374f2d074b3024fe798287e507..44f67aa1bd0d5629ebb56a2ea1996a6e5b68b092 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;