602 csi_thread_data_t *thread = (csi_thread_data_t *) params;
(1) Event alias:
Assigning: "args" = "thread->args".
603 struct ind_args *args = thread->args;
(2) Event deref_ptr:
Directly dereferencing pointer "args".
...
(3) Event check_after_deref:
Null-checking "thread->args" suggests that it may be null, but it
has already been dereferenced on all paths leading to the check.
728 if (thread->args != NULL) {
729 stdi_free_ind_args(&thread->args);
730 }
Resolve by changing the initialization to only set 'args', 'context', and
'prefix' if thread->args is not NULL. Each is initialized to NULL so the
if prefix == NULL is still valid
---
src/Virt_ComputerSystemIndication.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/Virt_ComputerSystemIndication.c b/src/Virt_ComputerSystemIndication.c
index 1ae8193..04e4d89 100644
--- a/src/Virt_ComputerSystemIndication.c
+++ b/src/Virt_ComputerSystemIndication.c
@@ -600,9 +600,9 @@ static CMPI_THREAD_RETURN lifecycle_thread_native(void *params)
{
CU_DEBUG("Entering libvirtc-cim native CSI thread.");
csi_thread_data_t *thread = (csi_thread_data_t *) params;
- struct ind_args *args = thread->args;
- CMPIContext *context = args->context;
- char *prefix = class_prefix_name(args->classname);
+ struct ind_args *args = NULL;
+ CMPIContext *context = NULL;
+ char *prefix = NULL;
virConnectPtr conn;
CMPIStatus s;
int retry_time = FAIL_WAIT_TIME;
@@ -614,6 +614,11 @@ static CMPI_THREAD_RETURN lifecycle_thread_native(void *params)
virDomainPtr *tmp_list = NULL;
int CBAttached = 0;
+ if (thread->args != NULL) {
+ args = thread->args;
+ context = args->context;
+ prefix = class_prefix_name(args->classname);
+ }
if (prefix == NULL) {
goto init_out;
}
--
1.8.1.4