
From: Eduardo Lima (Etrunko) <eblima@br.ibm.com> As revealed by Coverity scan report: https://bugzilla.redhat.com/show_bug.cgi?id=728245#c8 https://bugzilla.redhat.com/attachment.cgi?id=530435 Error: REVERSE_INULL: pool_parsing.c:74: deref_ptr: Directly dereferencing pointer "pool". pool_parsing.c:76: check_after_deref: Dereferencing "pool" before a null check. Error: REVERSE_INULL: pool_parsing.c:99: deref_ptr: Directly dereferencing pointer "res". pool_parsing.c:101: check_after_deref: Dereferencing "res" before a null check. Signed-off-by: Eduardo Lima (Etrunko) <eblima@br.ibm.com> --- libxkutil/pool_parsing.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/libxkutil/pool_parsing.c b/libxkutil/pool_parsing.c index f7a5a2c..f73b0fd 100644 --- a/libxkutil/pool_parsing.c +++ b/libxkutil/pool_parsing.c @@ -71,11 +71,12 @@ static void cleanup_disk_pool(struct disk_pool pool) { void cleanup_virt_pool(struct virt_pool **pool) { - struct virt_pool *_pool = *pool; + struct virt_pool *_pool; if ((pool == NULL) || (*pool == NULL)) return; - + + _pool = *pool; if (_pool->type == CIM_RES_TYPE_NET) cleanup_net_pool(_pool->pool_info.net); else if (_pool->type == CIM_RES_TYPE_DISK) @@ -96,11 +97,13 @@ static void cleanup_image_res(struct storage_vol vol) void cleanup_virt_pool_res(struct virt_pool_res **res) { - struct virt_pool_res *_res = *res; + struct virt_pool_res *_res; if ((res == NULL) || (*res == NULL)) return; + _res = *res; + if (_res->type == CIM_RES_TYPE_IMAGE) cleanup_image_res(_res->res.storage_vol); -- 1.7.4.4