chiark / gitweb /
test-bus-policy: silence coverity
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Sun, 28 Sep 2014 16:46:15 +0000 (18:46 +0200)
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Sun, 28 Sep 2014 16:48:33 +0000 (18:48 +0200)
Check if strjoin worked and also use _cleanup_free_ since we are
here.

Found with Coverity. Fixes CID#1241962

src/bus-proxyd/test-bus-policy.c

index 900e4d2..7bcebef 100644 (file)
 
 static int test_policy_load(Policy *p, const char *name)
 {
-        char *path;
+        _cleanup_free_ char *path = NULL;
         int r = 0;
 
         path = strjoin(TEST_DIR, "/bus-policy/", name, NULL);
+        assert_se(path);
 
         if (access(path, R_OK) == 0)
                 policy_load(p, STRV_MAKE(path));
         else
                 r = -ENOENT;
 
-        free(path);
-
         return r;
 }