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:
Yan, Like 2018-10-16 11:15:47 +08:00 committed by wenlingz
parent da3b02702f
commit e8c86566b1
1 changed files with 7 additions and 2 deletions

View File

@ -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--);