Skip to content

Commit

Permalink
Fixed resource leak, CID 1566947, 1566965, 1566967, 1568542, 1568543
Browse files Browse the repository at this point in the history
  • Loading branch information
olszomal authored and mtrojnar committed Oct 9, 2023
1 parent cdb7557 commit a5690f2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions appx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1798,6 +1798,10 @@ static size_t zipReadFileData(ZIP_FILE *zip, uint8_t **pData, ZIP_CENTRAL_DIRECT
compressedData[compressedSize] = 0;
}
if (entry->compression == COMPRESSION_NONE) {
if (compressedSize == 0) {
OPENSSL_free(compressedData);
return 0; /* FAILED */
}
*pData = compressedData;
dataSize = compressedSize;
} else if (entry->compression == COMPRESSION_DEFLATE) {
Expand All @@ -1814,6 +1818,10 @@ static size_t zipReadFileData(ZIP_FILE *zip, uint8_t **pData, ZIP_CENTRAL_DIRECT
OPENSSL_free(uncompressedData);
return 0; /* FAILED */
} else {
if (destLen == 0) {
OPENSSL_free(uncompressedData);
return 0; /* FAILED */
}
*pData = uncompressedData;
dataSize = destLen;
}
Expand Down

0 comments on commit a5690f2

Please sign in to comment.