From: Wido den Hollander Date: Tue, 16 Jul 2013 12:26:07 +0000 (+0200) Subject: rbd: Do not free the secret if it is not set X-Git-Tag: v1.0.5.5~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c636c41af71f11d5ca52cb615bb449e796e39bab;p=thirdparty%2Flibvirt.git rbd: Do not free the secret if it is not set 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 (cherry picked from commit d58c8478443d49c6e702bbb2c56a567ef23f036f) --- diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c index e815192c22..30d7cf2c94 100644 --- a/src/storage/storage_backend_rbd.c +++ b/src/storage/storage_backend_rbd.c @@ -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;