]> git.ipfire.org Git - people/ms/pakfire.git/commitdiff
compress: Fix potential leak of cookie
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 2 Jul 2021 15:22:31 +0000 (15:22 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 2 Jul 2021 15:22:31 +0000 (15:22 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/compress.c

index 89275e2ae7e8060fb7f4508f45e829ab44b7b868..91c81d779d1d7e9977674ebdbbf6137a6d2da4ce 100644 (file)
@@ -287,14 +287,17 @@ FILE* pakfire_xzfopen(FILE* f, const char* mode) {
 
                default:
                        errno = ENOTSUP;
-                       free(cookie);
-                       return NULL;
+                       goto ERROR;
        }
 
        if (ret != LZMA_OK)
-               return NULL;
+               goto ERROR;
 
        return fopencookie(cookie, mode, xz_functions);
+
+ERROR:
+       free(cookie);
+       return NULL;
 }
 
 // ZSTD