In testVshTableNew() we test whether vshTableNew(NULL) allocates
a table. This is expected to fail (and return NULL), because
passing nothing but NULL to vshTableNew() is viewed as error.
Nevertheless, if vshTableNew() did not fail and returned an
allocated table it would be leaked.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tests/vshtabletest.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tests/vshtabletest.c b/tests/vshtabletest.c
index 41ceec0a51..2b997753ff 100644
--- a/tests/vshtabletest.c
+++ b/tests/vshtabletest.c
@@ -33,7 +33,9 @@
static int
testVshTableNew(const void *opaque G_GNUC_UNUSED)
{
- if (vshTableNew(NULL)) {
+ g_autoptr(vshTable) table = vshTableNew(NULL);
+
+ if (table) {
fprintf(stderr, "expected failure when passing null to
vshTableNew\n");
return -1;
}
--
2.32.0