]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/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>
Tue, 16 Jul 2013 13:13:11 +0000 (15: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>
src/storage/storage_backend_rbd.c

index 493e33bc40adeed9161bb385e345e841d11460cc..badbdac96250aad72a3e5eee3563946cb26ec19c 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;