summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/libtar/files/0009-Check-for-NULL-before-freeing-th_pathname.patch
blob: 2d8f21171bc21d60b4d54c3331e0d026539cbe07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From bc8ec7d940d7ffc870638521bd134098d2efa5df Mon Sep 17 00:00:00 2001
From: Chris Frey <cdfrey@foursquare.net>
Date: Thu, 24 Oct 2013 17:55:12 -0400
Subject: [PATCH] Check for NULL before freeing th_pathname

Thanks to Harald Koch for pointing out that AIX 4 and 5 still need this.

Authored by Chris Frey <cdfrey@foursquare.net>.

Upstream-Status: Backport [https://repo.or.cz/libtar.git/commit/495d0c0eabc5648186e7d58ad54b508d14af38f4]

Signed-off-by: Katariina Lounento <katariina.lounento@vaisala.com>
---
 lib/handle.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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