From 39d963d1c0090fab56ac4998f81ec7aabd0cfe00 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 19 Aug 2013 14:02:52 +0200 Subject: [PATCH] virbitmaptest: Shut coverity up in case of broken test Coverity reported a memleak in the test added in 7efd5fd1b02. In case the code will be broken and the code will actually parse a faulty bitmap the resulting pointer would be leaked. Free it although that shouldn't ever happen. --- tests/virbitmaptest.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/virbitmaptest.c b/tests/virbitmaptest.c index c56d6fa284..7ec78fdad4 100644 --- a/tests/virbitmaptest.c +++ b/tests/virbitmaptest.c @@ -470,7 +470,7 @@ static int test9(const void *opaque ATTRIBUTE_UNUSED) { int ret = -1; - virBitmapPtr bitmap; + virBitmapPtr bitmap = NULL; if (virBitmapParse("100000000", 0, &bitmap, 20) != -1) goto cleanup; @@ -492,6 +492,7 @@ test9(const void *opaque ATTRIBUTE_UNUSED) ret = 0; cleanup: + virBitmapFree(bitmap); return ret; } -- GitLab