diff options
Diffstat (limited to 'src/archive.c')
-rw-r--r-- | src/archive.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/archive.c b/src/archive.c index eabd3bf..24676b1 100644 --- a/src/archive.c +++ b/src/archive.c @@ -138,6 +138,8 @@ int apk_tar_parse(struct apk_istream *is, apk_archive_entry_parser parser, apk_blob_t pax = APK_BLOB_NULL, longname = APK_BLOB_NULL; char filename[sizeof buf.name + sizeof buf.prefix + 2]; + if (IS_ERR_OR_NULL(is)) return PTR_ERR(is) ?: -EINVAL; + memset(&entry, 0, sizeof(entry)); entry.name = buf.name; while ((r = apk_istream_read(is, &buf, 512)) == 512) { @@ -262,6 +264,7 @@ ok: free(pax.ptr); free(longname.ptr); apk_fileinfo_free(&entry); + apk_istream_close(is); return r; } |