tools:acrn-crashlog: fix potential memory corruption

Make sure vm event is not NULL before freeing vm_msg.

Tracked-On: #1024
Signed-off-by: Liu, Xinwu <xinwu.liu@intel.com>
Reviewed-by: Liu, Xiaojing <xiaojing.liu@intel.com>
Acked-by: Chen, Gang <gang.c.chen@intel.com>
This commit is contained in:
Liu, Xinwu 2019-05-23 13:02:34 +08:00 committed by ACRN System Integration
parent 5a23f7b664
commit 0a461a4532

View File

@ -177,7 +177,7 @@ static void *event_handle(void *unused __attribute__((unused)))
if (e->event_type == VM) {
vme = (struct vm_event_t *)e->private;
if (vme->vm_msg)
if (vme && vme->vm_msg)
free(vme->vm_msg);
if (vme)
free(vme);