You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.3 KiB

From 55d3f9fc5b9b0e45ed843a40a70b24d168d83d86 Mon Sep 17 00:00:00 2001
From: John Ferlan <jferlan@redhat.com>
Date: Wed, 22 Jan 2014 13:21:17 -0500
Subject: [PATCH 44/60] RAFP: Coverity cleanup
A new version of Coverity found:
filter_by_pool(): RESOURCE_LEAK
- Because the code is run within a for() loop Coverity complains
that the returned 'poolid' is not free'd during each pass through
the loop. So even though it may not be fetched again, just free()
and reinitialize 'poolid' after usage
Signed-off-by: John Ferlan <jferlan@redhat.com>
---
src/Virt_ResourceAllocationFromPool.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/Virt_ResourceAllocationFromPool.c b/src/Virt_ResourceAllocationFromPool.c
index 7088900..7bee729 100644
--- a/src/Virt_ResourceAllocationFromPool.c
+++ b/src/Virt_ResourceAllocationFromPool.c
@@ -120,9 +120,12 @@ static int filter_by_pool(struct inst_list *dest,
poolid = pool_member_of(_BROKER, CLASSNAME(op), type, rasd_id);
if ((poolid != NULL) && STREQ(poolid, _poolid))
inst_list_add(dest, inst);
- }
- free(poolid);
+ if (poolid != NULL) {
+ free(poolid);
+ poolid = NULL;
+ }
+ }
return dest->cur;
}
--
2.1.0