From c1405f9311a1789727c14858e1bb770965fa03ff Mon Sep 17 00:00:00 2001 From: Timo Teräs Date: Sun, 25 Jul 2021 08:52:43 +0300 Subject: adb: fix error handling of non-adb files --- src/adb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/adb.c') diff --git a/src/adb.c b/src/adb.c index 69b58fb..1fc135c 100644 --- a/src/adb.c +++ b/src/adb.c @@ -257,7 +257,10 @@ err: int adb_m_process(struct adb *db, struct apk_istream *is, uint32_t expected_schema, struct apk_trust *t, int (*cb)(struct adb *, struct adb_block *, struct apk_istream *)) { - apk_blob_t mmap = apk_istream_mmap(is); + apk_blob_t mmap; + + if (IS_ERR(is)) return PTR_ERR(is); + mmap = apk_istream_mmap(is); memset(db, 0, sizeof *db); if (expected_schema & ADB_SCHEMA_IMPLIED) db->schema = expected_schema & ~ADB_SCHEMA_IMPLIED; -- cgit v1.2.3-70-g09d2