MfP4: Joerg Sonnenberger's fixes to make 'ar' and 'pax' writers

robust against multiple calls to their destroy() functions.
This commit is contained in:
Tim Kientzle 2008-08-10 02:06:28 +00:00
parent d09ece9e4e
commit 07fe09e227
2 changed files with 6 additions and 0 deletions

View File

@ -389,6 +389,9 @@ archive_write_ar_destroy(struct archive_write *a)
ar = (struct ar_w *)a->format_data;
if (ar == NULL)
return (ARCHIVE_OK);
if (ar->has_strtab > 0) {
free(ar->strtab);
ar->strtab = NULL;

View File

@ -1200,6 +1200,9 @@ archive_write_pax_destroy(struct archive_write *a)
struct pax *pax;
pax = (struct pax *)a->format_data;
if (pax == NULL)
return (ARCHIVE_OK);
archive_string_free(&pax->pax_header);
free(pax);
a->format_data = NULL;