Blob Blame History Raw
From 78e95da690556874baac96dd1d655e577c6d8e95 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Tue, 4 Oct 2022 10:39:35 +0200
Subject: [PATCH] free memory allocated by gnu_long* fields

---
 lib/handle.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/handle.c b/lib/handle.c
index 28a7dc2..18bd8dc 100644
--- a/lib/handle.c
+++ b/lib/handle.c
@@ -122,8 +122,11 @@ tar_close(TAR *t)
 		libtar_hash_free(t->h, ((t->oflags & O_ACCMODE) == O_RDONLY
 					? free
 					: (libtar_freefunc_t)tar_dev_free));
-	if (t->th_pathname != NULL)
-		free(t->th_pathname);
+
+	free(t->th_pathname);
+	free(t->th_buf.gnu_longname);
+	free(t->th_buf.gnu_longlink);
+
 	free(t);
 
 	return i;
-- 
2.38.1