[libvirt] [PATCH] storage: Clean up error path for create buildPool failure

Commit id 'aeb1078ab' added a buildPool option and failure path which calls virStoragePoolObjRemove, which unlocks the pool, clears the 'pool' variable, and goto cleanup. However, at cleanup virStoragePoolObjUnlock is called without check if pool is non NULL. Signed-off-by: John Ferlan <jferlan@redhat.com> --- src/storage/storage_driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 0bb577f..81c0b8c 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -930,7 +930,8 @@ storagePoolCreate(virStoragePoolPtr obj, cleanup: VIR_FREE(stateFile); - virStoragePoolObjUnlock(pool); + if (pool) + virStoragePoolObjUnlock(pool); return ret; } -- 2.5.0

ping - Tks - John On 12/18/2015 08:07 AM, John Ferlan wrote:
Commit id 'aeb1078ab' added a buildPool option and failure path which calls virStoragePoolObjRemove, which unlocks the pool, clears the 'pool' variable, and goto cleanup. However, at cleanup virStoragePoolObjUnlock is called without check if pool is non NULL.
Signed-off-by: John Ferlan <jferlan@redhat.com> --- src/storage/storage_driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 0bb577f..81c0b8c 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -930,7 +930,8 @@ storagePoolCreate(virStoragePoolPtr obj,
cleanup: VIR_FREE(stateFile); - virStoragePoolObjUnlock(pool); + if (pool) + virStoragePoolObjUnlock(pool); return ret; }

On Fri, Dec 18, 2015 at 08:07:36AM -0500, John Ferlan wrote:
Commit id 'aeb1078ab' added a buildPool option and failure path which calls virStoragePoolObjRemove, which unlocks the pool, clears the 'pool' variable, and goto cleanup. However, at cleanup virStoragePoolObjUnlock is called without check if pool is non NULL.
Signed-off-by: John Ferlan <jferlan@redhat.com> --- src/storage/storage_driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
ACK Jan
participants (2)
-
John Ferlan
-
Ján Tomko