tools: acrn-manager: fix a potential NULL pointer dereference
check the return value of vmmngr_find() before dereference in wait_vm_stop() Tracked-On: #1479 Signed-off-by: Yan, Like <like.yan@intel.com>
This commit is contained in:
parent
da3b02702f
commit
e8c86566b1
|
@ -504,8 +504,13 @@ static int wait_vm_stop(const char * vmname, unsigned int timeout)
|
|||
vmmngr_update();
|
||||
|
||||
s = vmmngr_find(vmname);
|
||||
if (s->state == VM_CREATED)
|
||||
return 0;
|
||||
if (s == NULL) {
|
||||
printf("%s: vm %s not found\n", __func__, vmname);
|
||||
return -1;
|
||||
} else {
|
||||
if (s->state == VM_CREATED)
|
||||
return 0;
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
} while (t--);
|
||||
|
|
Loading…
Reference in New Issue