test: fix a potential memory leak
authorPeter Hutterer <peter.hutterer@who-t.net>
Tue, 5 Nov 2019 03:22:49 +0000 (13:22 +1000)
committerRan Benita <ran234@gmail.com>
Thu, 7 Nov 2019 09:10:00 +0000 (11:10 +0200)
Found by coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
test/common.c

index c371272..fbe72a7 100644 (file)
@@ -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);