summaryrefslogtreecommitdiff
path: root/lib/tar/cleanup.c
blob: c4d17346818362225574ac271cc70c9a1ea3417a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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));
}