mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-21 19:02:25 +00:00
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: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
7617e5e45d
commit
5e67ed4215
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user