[PATCH] fix: possible memory leak in unxz()
From: Vishnu Sanal T
Date: Sun Oct 06 2024 - 03:24:39 EST
Fixes possible memory leak in the function unxz() in
lib/decompress_unxz.c forgets to free the pointer 'in', when
the statement if (fill == NULL && flush == NULL) is true.
Signed-off-by: Vishnu Sanal T <t.v.s10123@xxxxxxxxx>
---
lib/decompress_unxz.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/decompress_unxz.c b/lib/decompress_unxz.c
index 32138bb8ef77..8d58207ca1db 100644
--- a/lib/decompress_unxz.c
+++ b/lib/decompress_unxz.c
@@ -343,13 +343,13 @@ STATIC int INIT unxz(unsigned char *in, long in_size,
}
} while (ret == XZ_OK);
- if (must_free_in)
- free(in);
-
if (flush != NULL)
free(b.out);
}
+ if (must_free_in)
+ free(in);
+
if (in_used != NULL)
*in_used += b.in_pos;
--
2.46.2