[libvirt] [PATCH] 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 <wido@widodh.nl> --- src/storage/storage_backend_rbd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c index 493e33b..1f75481 100644 --- a/src/storage/storage_backend_rbd.c +++ b/src/storage/storage_backend_rbd.c @@ -176,7 +176,11 @@ 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; -- 1.7.9.5

On 07/16/2013 02:26 PM, Wido den Hollander wrote:
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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
ACK I've removed the extra braces and pushed it. Jan
participants (2)
-
Ján Tomko
-
Wido den Hollander