]> git.ipfire.org Git - pakfire.git/commitdiff
compress: Free the cookie if level parsing fails
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 31 Jan 2025 09:44:15 +0000 (09:44 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 31 Jan 2025 09:44:15 +0000 (09:44 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/compress.c

index 021f8377cf2ad90cc72d004e144044346f660d92..9dba2a0c91ec0f42d66f2da342d23b660e5e34fb 100644 (file)
@@ -392,7 +392,7 @@ FILE* pakfire_xzfopen(FILE* f, const char* mode) {
                        // Try parsing the level
                        r = parse_level(&level, mode);
                        if (r < 0)
-                               return NULL;
+                               goto ERROR;
 
                        ret = lzma_easy_encoder(&cookie->stream, level, LZMA_CHECK_SHA256);
                        break;
@@ -632,7 +632,7 @@ FILE* pakfire_zstdfopen(FILE* f, const char* mode) {
                        // Try parsing the level
                        r = parse_level(&level, mode);
                        if (r < 0)
-                               return NULL;
+                               goto ERROR;
 
                        // Allocate stream
                        cookie->cstream = ZSTD_createCStream();