aboutsummaryrefslogtreecommitdiff
path: root/lib/tar/read_header.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-06-29 02:26:44 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-06-29 02:26:57 +0200
commitd2f27dc653767f36885916d9ecd7b059673d26d8 (patch)
tree4fabf5c138d917de4bea15e49022aabd806b6f07 /lib/tar/read_header.c
parent8c5226588de702c12305b356bc3e52c8e6754396 (diff)
tar reader: propperly cleanup on failure
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/tar/read_header.c')
-rw-r--r--lib/tar/read_header.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/tar/read_header.c b/lib/tar/read_header.c
index 9ef20b6..76634e1 100644
--- a/lib/tar/read_header.c
+++ b/lib/tar/read_header.c
@@ -489,7 +489,7 @@ int read_header(int fd, tar_header_decoded_t *out)
switch (hdr.typeflag) {
case TAR_TYPE_GNU_SLINK:
if (read_number(hdr.size, sizeof(hdr.size), &pax_size))
- return -1;
+ goto fail;
free(out->link_target);
out->link_target = record_to_memory(fd, pax_size);
if (out->link_target == NULL)
@@ -498,7 +498,7 @@ int read_header(int fd, tar_header_decoded_t *out)
continue;
case TAR_TYPE_GNU_PATH:
if (read_number(hdr.size, sizeof(hdr.size), &pax_size))
- return -1;
+ goto fail;
free(out->name);
out->name = record_to_memory(fd, pax_size);
if (out->name == NULL)
@@ -508,10 +508,10 @@ int read_header(int fd, tar_header_decoded_t *out)
case TAR_TYPE_PAX:
clear_header(out);
if (read_number(hdr.size, sizeof(hdr.size), &pax_size))
- return -1;
+ goto fail;
set_by_pax = 0;
if (read_pax_header(fd, pax_size, &set_by_pax, out))
- return -1;
+ goto fail;
continue;
}
break;