提交 5e67ed42 编写于 作者: D Daniel P. Berrange

Avoid crash on OOM in virportallocatortest

The virportallocatortest did not check if the object
allocation failed in all cases. This lead to a crash
on OOM in the testsuite
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 7617e5e4
......@@ -67,6 +67,9 @@ static int testAllocAll(const void *args ATTRIBUTE_UNUSED)
int ret = -1;
unsigned short p1, p2, p3, p4, p5, p6, p7;
if (!alloc)
return -1;
if (virPortAllocatorAcquire(alloc, &p1) < 0)
goto cleanup;
if (p1 != 5901) {
......@@ -137,6 +140,9 @@ static int testAllocReuse(const void *args ATTRIBUTE_UNUSED)
int ret = -1;
unsigned short p1, p2, p3, p4;
if (!alloc)
return -1;
if (virPortAllocatorAcquire(alloc, &p1) < 0)
goto cleanup;
if (p1 != 5901) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册