Commit 96ef14ac949ba56bdf1358b65c5a95e48611f45e

Peter Hutterer 2019-11-05T13:22:49

test: fix a potential memory leak Found by coverity Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/test/common.c b/test/common.c
index c371272..fbe72a7 100644
--- a/test/common.c
+++ b/test/common.c
@@ -247,8 +247,10 @@ test_get_context(enum test_context_flags test_flags)
         return NULL;
 
     path = test_get_path("");
-    if (!path)
+    if (!path) {
+        xkb_context_unref(ctx);
         return NULL;
+    }
 
     xkb_context_include_path_append(ctx, path);
     free(path);