From: Eduardo Lima (Etrunko) <eblima(a)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: UNINIT:
Virt_ComputerSystemIndication.c:435: var_decl: Declaring variable
"affected_inst" without initializer.
Virt_ComputerSystemIndication.c:478: uninit_use: Using uninitialized value
"affected_inst".
Error: UNINIT:
Virt_ElementCapabilities.c:86: var_decl: Declaring variable "_inst" without
initializer.
Virt_ElementCapabilities.c:117: uninit_use: Using uninitialized value "_inst".
Error: UNINIT:
Virt_ElementCapabilities.c:132: var_decl: Declaring variable "_inst" without
initializer.
Virt_ElementCapabilities.c:160: uninit_use: Using uninitialized value "_inst".
Error: UNINIT:
Virt_VirtualSystemManagementService.c:2516: var_decl: Declaring variable "s"
without initializer.
Virt_VirtualSystemManagementService.c:2619: uninit_use: Using uninitialized
value "s": field "s".msg
is
uninitialized.
Error: UNINIT:
Virt_VirtualSystemSnapshotService.c:490: var_decl: Declaring variable "s"
without initializer.
Virt_VirtualSystemSnapshotService.c:509: uninit_use: Using uninitialized value
"s": field "s".msg is
uninitialized.
Signed-off-by: Eduardo Lima (Etrunko) <eblima(a)br.ibm.com>
---
src/Virt_ComputerSystemIndication.c | 3 +++
src/Virt_ElementCapabilities.c | 4 ++--
src/Virt_VirtualSystemManagementService.c | 4 ++--
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/Virt_ComputerSystemIndication.c b/src/Virt_ComputerSystemIndication.c
index 9b3b80b..a00444d 100644
--- a/src/Virt_ComputerSystemIndication.c
+++ b/src/Virt_ComputerSystemIndication.c
@@ -471,6 +471,9 @@ static bool async_ind(CMPIContext *context,
CU_DEBUG("Could not recreate guest instance");
goto out;
}
+ } else {
+ CU_DEBUG("Unrecognized indication type");
+ goto out;
}
/* FIXME: We are unable to get the previous CS instance after it has
diff --git a/src/Virt_ElementCapabilities.c b/src/Virt_ElementCapabilities.c
index d74bf93..6bd846a 100644
--- a/src/Virt_ElementCapabilities.c
+++ b/src/Virt_ElementCapabilities.c
@@ -83,7 +83,7 @@ static CMPIStatus validate_caps_get_service_or_rp(const CMPIContext
*context,
CMPIInstance **inst)
{
CMPIStatus s = {CMPI_RC_OK, NULL};
- CMPIInstance *_inst;
+ CMPIInstance *_inst = NULL;
char* classname;
classname = class_base_name(CLASSNAME(ref));
@@ -129,7 +129,7 @@ static CMPIStatus validate_service_get_caps(const CMPIContext
*context,
CMPIInstance **inst)
{
CMPIStatus s = {CMPI_RC_OK, NULL};
- CMPIInstance *_inst;
+ CMPIInstance *_inst = NULL;
char* classname;
classname = class_base_name(CLASSNAME(ref));
diff --git a/src/Virt_VirtualSystemManagementService.c
b/src/Virt_VirtualSystemManagementService.c
index fa1e266..21979c3 100644
--- a/src/Virt_VirtualSystemManagementService.c
+++ b/src/Virt_VirtualSystemManagementService.c
@@ -387,7 +387,7 @@ static int bootord_vssd_to_domain(CMPIInstance *inst,
CMPICount i;
CMPICount bl_size;
CMPIArray *bootlist;
- CMPIStatus s;
+ CMPIStatus s = { CMPI_RC_OK, NULL };
CMPIData boot_elem;
char **tmp_str_arr;
@@ -2467,7 +2467,7 @@ static CMPIStatus _resource_dynamic(struct domain *dominfo,
enum ResourceAction action,
const char *refcn)
{
- CMPIStatus s;
+ CMPIStatus s = { CMPI_RC_OK, NULL };
virConnectPtr conn;
virDomainPtr dom;
int (*func)(virDomainPtr, struct virt_device *);
--
1.7.4.4