lib: decompress_unxz: make it obvious that there is no memory leak

Calling __decompress() or unxz() with fill == NULL && flush == NULL && in
== NULL is invalid, thus there were no memory leaks even though it might
have looked like that.  Move the conditional free() calls so that it's
obvious that there are no leaks.

Link: https://lore.kernel.org/[email protected]
Link: https://lore.kernel.org/lkml/[email protected]/T/
Link: https://lore.kernel.org/lkml/[email protected]/T/
Signed-off-by: Ivy Lopez <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=207113
Reviewed-by: Lasse Collin <[email protected]>
This commit is contained in:
Ivy Lopez
2026-10-06 19:03:00 -07:00
committed by Andrew Morton
parent 1d44085785
commit aa4b0525ff
+6 -6
View File
@@ -342,14 +342,14 @@ STATIC int INIT unxz(unsigned char *in, long in_size,
b.out_pos = 0;
}
} while (ret == XZ_OK);
if (must_free_in)
free(in);
if (flush != NULL)
free(b.out);
}
if (must_free_in)
free(in);
if (flush != NULL)
free(b.out);
if (in_used != NULL)
*in_used += b.in_pos;