diff options
Diffstat (limited to 'lib/tar/cleanup.c')
-rw-r--r-- | lib/tar/cleanup.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/tar/cleanup.c b/lib/tar/cleanup.c new file mode 100644 index 0000000..c4d1734 --- /dev/null +++ b/lib/tar/cleanup.c @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-3.0-or-later */ +#include "internal.h" + +void free_sparse_list(sparse_map_t *sparse) +{ + sparse_map_t *old; + + while (sparse != NULL) { + old = sparse; + sparse = sparse->next; + free(old); + } +} + +void clear_header(tar_header_decoded_t *hdr) +{ + free_sparse_list(hdr->sparse); + free(hdr->name); + free(hdr->link_target); + memset(hdr, 0, sizeof(*hdr)); +} |