(4) Event check_return:
Calling function "cu_get_str_prop(CMPIInstance const *, char const *,
char const **)" without checking return value (as is done elsewhere 72
out of 77 times).
(11) Event unchecked_value:
No check of the return value of "cu_get_str_prop(inst,
"CreationClassName", &cn)".
118 cu_get_str_prop(inst, "CreationClassName", &cn);
119 cu_get_str_prop(inst, "DeviceID", &dev_id);
120
121 if ((dev_id == NULL) || (cn == NULL))
122 continue;
Resolve by making proper check of function return vs. CMPI_RC_OK and removing
the NULL checks since they are redundant.
---
src/Virt_ElementAllocatedFromPool.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/Virt_ElementAllocatedFromPool.c b/src/Virt_ElementAllocatedFromPool.c
index ad9134c..c7813b7 100644
--- a/src/Virt_ElementAllocatedFromPool.c
+++ b/src/Virt_ElementAllocatedFromPool.c
@@ -115,10 +115,10 @@ static CMPIStatus get_dev_from_pool(const CMPIObjectPath *ref,
const char *cn = NULL;
const char *dev_id = NULL;
- cu_get_str_prop(inst, "CreationClassName", &cn);
- cu_get_str_prop(inst, "DeviceID", &dev_id);
-
- if ((dev_id == NULL) || (cn == NULL))
+ if (cu_get_str_prop(inst, "CreationClassName", &cn) !=
+ CMPI_RC_OK)
+ continue;
+ if (cu_get_str_prop(inst, "DeviceID", &dev_id) !=
CMPI_RC_OK)
continue;
poolid = pool_member_of(_BROKER, cn, type, dev_id);
--
1.8.1.4