From: "Daniel P. Berrange" <berrange@xxxxxxxxxx> The virlockspacetest.c did not check for failure to create a lockspace, causing a crash on OOM Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx> --- tests/virlockspacetest.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/tests/virlockspacetest.c b/tests/virlockspacetest.c index b659f61..1985a4a 100644 --- a/tests/virlockspacetest.c +++ b/tests/virlockspacetest.c @@ -44,7 +44,8 @@ static int testLockSpaceCreate(const void *args ATTRIBUTE_UNUSED) rmdir(LOCKSPACE_DIR); - lockspace = virLockSpaceNew(LOCKSPACE_DIR); + if (!(lockspace = virLockSpaceNew(LOCKSPACE_DIR))) + goto cleanup; if (!virFileIsDir(LOCKSPACE_DIR)) goto cleanup; @@ -65,7 +66,8 @@ static int testLockSpaceResourceLifecycle(const void *args ATTRIBUTE_UNUSED) rmdir(LOCKSPACE_DIR); - lockspace = virLockSpaceNew(LOCKSPACE_DIR); + if (!(lockspace = virLockSpaceNew(LOCKSPACE_DIR))) + goto cleanup; if (!virFileIsDir(LOCKSPACE_DIR)) goto cleanup; @@ -98,7 +100,8 @@ static int testLockSpaceResourceLockExcl(const void *args ATTRIBUTE_UNUSED) rmdir(LOCKSPACE_DIR); - lockspace = virLockSpaceNew(LOCKSPACE_DIR); + if (!(lockspace = virLockSpaceNew(LOCKSPACE_DIR))) + goto cleanup; if (!virFileIsDir(LOCKSPACE_DIR)) goto cleanup; @@ -143,7 +146,8 @@ static int testLockSpaceResourceLockExclAuto(const void *args ATTRIBUTE_UNUSED) rmdir(LOCKSPACE_DIR); - lockspace = virLockSpaceNew(LOCKSPACE_DIR); + if (!(lockspace = virLockSpaceNew(LOCKSPACE_DIR))) + goto cleanup; if (!virFileIsDir(LOCKSPACE_DIR)) goto cleanup; @@ -180,7 +184,8 @@ static int testLockSpaceResourceLockShr(const void *args ATTRIBUTE_UNUSED) rmdir(LOCKSPACE_DIR); - lockspace = virLockSpaceNew(LOCKSPACE_DIR); + if (!(lockspace = virLockSpaceNew(LOCKSPACE_DIR))) + goto cleanup; if (!virFileIsDir(LOCKSPACE_DIR)) goto cleanup; @@ -233,7 +238,8 @@ static int testLockSpaceResourceLockShrAuto(const void *args ATTRIBUTE_UNUSED) rmdir(LOCKSPACE_DIR); - lockspace = virLockSpaceNew(LOCKSPACE_DIR); + if (!(lockspace = virLockSpaceNew(LOCKSPACE_DIR))) + goto cleanup; if (!virFileIsDir(LOCKSPACE_DIR)) goto cleanup; @@ -292,7 +298,8 @@ static int testLockSpaceResourceLockPath(const void *args ATTRIBUTE_UNUSED) rmdir(LOCKSPACE_DIR); - lockspace = virLockSpaceNew(NULL); + if (!(lockspace = virLockSpaceNew(NULL))) + goto cleanup; if (mkdir(LOCKSPACE_DIR, 0700) < 0) goto cleanup; -- 1.8.3.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list