summaryrefslogtreecommitdiff
path: root/src/archive.c
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-01-06 19:44:08 +0200
committerTimo Teras <timo.teras@iki.fi>2009-01-06 21:23:26 +0200
commit64b630b5fb5067285ef539abf7d360f6802fa578 (patch)
treec649cd5537e5cd52ef0e6466dcc3bedf4981bc37 /src/archive.c
parenta3769b22380e98547937a8c00feeaef2ed2af8bc (diff)
downloadapk-tools-64b630b5fb5067285ef539abf7d360f6802fa578.tar.gz
apk-tools-64b630b5fb5067285ef539abf7d360f6802fa578.tar.bz2
apk-tools-64b630b5fb5067285ef539abf7d360f6802fa578.tar.xz
apk-tools-64b630b5fb5067285ef539abf7d360f6802fa578.zip
archive: minor clean ups
Diffstat (limited to 'src/archive.c')
-rw-r--r--src/archive.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/archive.c b/src/archive.c
index 201412b..0cb575b 100644
--- a/src/archive.c
+++ b/src/archive.c
@@ -115,6 +115,7 @@ int apk_parse_tar(struct apk_istream *is, apk_archive_entry_parser parser,
free(entry.name);
entry.name = malloc(entry.size+1);
is->read(is, entry.name, entry.size);
+ entry.name[entry.size] = 0;
offset += entry.size;
entry.size = 0;
break;
@@ -133,7 +134,7 @@ int apk_parse_tar(struct apk_istream *is, apk_archive_entry_parser parser,
case '3': /* char device */
entry.mode |= S_IFCHR;
break;
- case '4': /* block devicek */
+ case '4': /* block device */
entry.mode |= S_IFBLK;
break;
case '5': /* directory */
@@ -151,10 +152,10 @@ int apk_parse_tar(struct apk_istream *is, apk_archive_entry_parser parser,
/* callback parser function */
csum_init(&teis.csum_ctx);
r = parser(ctx, &entry, &teis.is);
+ free(entry.name);
if (r != 0)
return r;
- free(entry.name);
entry.name = NULL;
}