]> git.ipfire.org Git - pakfire.git/commitdiff
pakfire: Clean up after failing to create a temporary directory
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 31 Jan 2025 09:50:52 +0000 (09:50 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 31 Jan 2025 09:50:52 +0000 (09:50 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/pakfire.c

index 58135e968959fcb86180be69bf18ec9b7f1f0e10..7f943b1c64bc100b4ec684483ed87b1da8ef3f13 100644 (file)
@@ -1009,8 +1009,10 @@ int pakfire_create(struct pakfire** pakfire, struct pakfire_ctx* ctx,
 
                // Create a new temporary directory
                path = pakfire_mkdtemp(tmppath);
-               if (!path)
-                       return -errno;
+               if (!path) {
+                       r = -errno;
+                       goto ERROR;
+               }
 
                // Destroy the temporary directory afterwards
                p->internal_flags |= PAKFIRE_DESTROY_ON_FREE;