]> git.ipfire.org Git - pakfire.git/commitdiff
path: Convince the static analyzer that path is set
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 31 Dec 2024 14:05:45 +0000 (14:05 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 31 Dec 2024 14:05:45 +0000 (14:05 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/path.c

index 80bd7180886dcc9fd267e2f387c8142327123b9b..d0123e65c1c6fe3f4ea6627fc9980b16db1add3d 100644 (file)
@@ -535,20 +535,20 @@ int __pakfire_path_absolute(char* buffer, const size_t length, const char* s) {
 
        // Parse the path
        r = pakfire_path_parse(&path, s);
-       if (r)
-               goto ERROR;
+       if (r < 0)
+               return r;
+
+       // Make the static analyzer happy
+       if (!path)
+               return -EINVAL;
 
        // Make it absolute
        path->is_absolute = 1;
 
        // Write back the path
        r = pakfire_path_to_string(path, buffer, length);
-       if (r)
-               goto ERROR;
 
-ERROR:
-       if (path)
-               pakfire_path_free(path);
+       pakfire_path_free(path);
 
        return r;
 }