Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ tar_close(TAR *t)
: (libtar_freefunc_t)tar_dev_free));
if (t->th_pathname != NULL)
free(t->th_pathname);
free_longlink_longname(t->th_buf);
free(t);

return i;
Expand Down
6 changes: 6 additions & 0 deletions lib/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,13 @@ int_to_oct_nonull(int num, char *oct, size_t octlen)
void free_longlink_longname(struct tar_header th_buf)
{
if (th_buf.gnu_longname != NULL)
{
free(th_buf.gnu_longname);
th_buf.gnu_longname = NULL;
}
if (th_buf.gnu_longlink !=NULL)
{
free(th_buf.gnu_longlink);
th_buf.gnu_longlink = NULL;
}
}
4 changes: 1 addition & 3 deletions libtar/libtar.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ list(char *tarfile)
{
fprintf(stderr, "tar_skip_regfile(): %s\n",
strerror(errno));
free_longlink_longname(t->th_buf);
tar_close(t);
return -1;
}
}
Expand All @@ -218,12 +218,10 @@ list(char *tarfile)

if (tar_close(t) != 0)
{
free_longlink_longname(t->th_buf);
fprintf(stderr, "tar_close(): %s\n", strerror(errno));
return -1;
}

free_longlink_longname(t->th_buf);
return 0;
}

Expand Down