Check for NULL before freeing th_pathname
authorChris Frey <cdfrey@foursquare.net>
Thu, 24 Oct 2013 21:55:12 +0000 (24 17:55 -0400)
committerChris Frey <cdfrey@foursquare.net>
Thu, 24 Oct 2013 21:55:12 +0000 (24 17:55 -0400)
Thanks to Harald Koch for pointing out that AIX 4 and 5 still need this.

lib/handle.c

index a19c046..28a7dc2 100644 (file)
@@ -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;