提交 e786b578 编写于 作者: J John Ferlan 提交者: Peter Krempa

util: Need to check child JSON allocation before use

上级 1130fa31
...@@ -459,8 +459,10 @@ virJSONValuePtr virLockSpacePreExecRestart(virLockSpacePtr lockspace) ...@@ -459,8 +459,10 @@ virJSONValuePtr virLockSpacePreExecRestart(virLockSpacePtr lockspace)
virJSONValuePtr resources; virJSONValuePtr resources;
virHashKeyValuePairPtr pairs = NULL, tmp; virHashKeyValuePairPtr pairs = NULL, tmp;
if (!object) if (!object) {
virReportOOMError();
return NULL; return NULL;
}
virMutexLock(&lockspace->lock); virMutexLock(&lockspace->lock);
...@@ -483,6 +485,11 @@ virJSONValuePtr virLockSpacePreExecRestart(virLockSpacePtr lockspace) ...@@ -483,6 +485,11 @@ virJSONValuePtr virLockSpacePreExecRestart(virLockSpacePtr lockspace)
virJSONValuePtr owners = NULL; virJSONValuePtr owners = NULL;
size_t i; size_t i;
if (!child) {
virReportOOMError();
goto error;
}
if (virJSONValueArrayAppend(resources, child) < 0) { if (virJSONValueArrayAppend(resources, child) < 0) {
virJSONValueFree(child); virJSONValueFree(child);
goto error; goto error;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册