mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 23:07:44 +00:00
esx_vi: fix possible segfault
Clang found possible dereference of NULL pointer which is right. Function 'esxVI_LookupTaskInfoByTask' should find a task info. The issue is that we could return 0 and leave 'taksInfo' pointer NULL because if there is no match we simply end the search loop end set 'result' to 0. Every caller count on the fact that if the return value is 0 than it's safe to dereference 'taskInfo'. We should return 0 only in case we found something and the '*taskInfo' is not NULL. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
828e485bd5
commit
3baeea6239
@ -3292,14 +3292,13 @@ esxVI_LookupTaskInfoByTask(esxVI_Context *ctx,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
result = 0;
|
||||
break;
|
||||
} else {
|
||||
VIR_WARN("Unexpected '%s' property", dynamicProperty->name);
|
||||
}
|
||||
}
|
||||
|
||||
result = 0;
|
||||
|
||||
cleanup:
|
||||
esxVI_String_Free(&propertyNameList);
|
||||
esxVI_ObjectContent_Free(&objectContent);
|
||||
|
Loading…
Reference in New Issue
Block a user