mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
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/20260901014138.22699-1-skunkolee@gmail.com Link: https://lore.kernel.org/lkml/20241006072542.66442-2-t.v.s10123@gmail.com/T/ Link: https://lore.kernel.org/lkml/20260825191333.34276-1-skunkolee@gmail.com/T/ Signed-off-by: Ivy Lopez <skunkolee@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=207113 Reviewed-by: Lasse Collin <lasse.collin@tukaani.org>
This commit is contained in:
parent
1d44085785
commit
aa4b0525ff
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user