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-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=d58c8478443d49c6e702bbb2c56a567ef23f036f;p=people%2Fliuw%2Flibxenctrl-split%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 --- diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c index 493e33bc4..badbdac96 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;