Fixed resource leak, CID 1566947, 1566965, 1566967, 1568542, 1568543

This commit is contained in:
olszomal 2023-10-09 15:45:10 +02:00 committed by Michał Trojnara
parent cdb75578e9
commit a5690f2d19

8
appx.c
View File

@ -1798,6 +1798,10 @@ static size_t zipReadFileData(ZIP_FILE *zip, uint8_t **pData, ZIP_CENTRAL_DIRECT
compressedData[compressedSize] = 0; compressedData[compressedSize] = 0;
} }
if (entry->compression == COMPRESSION_NONE) { if (entry->compression == COMPRESSION_NONE) {
if (compressedSize == 0) {
OPENSSL_free(compressedData);
return 0; /* FAILED */
}
*pData = compressedData; *pData = compressedData;
dataSize = compressedSize; dataSize = compressedSize;
} else if (entry->compression == COMPRESSION_DEFLATE) { } else if (entry->compression == COMPRESSION_DEFLATE) {
@ -1814,6 +1818,10 @@ static size_t zipReadFileData(ZIP_FILE *zip, uint8_t **pData, ZIP_CENTRAL_DIRECT
OPENSSL_free(uncompressedData); OPENSSL_free(uncompressedData);
return 0; /* FAILED */ return 0; /* FAILED */
} else { } else {
if (destLen == 0) {
OPENSSL_free(uncompressedData);
return 0; /* FAILED */
}
*pData = uncompressedData; *pData = uncompressedData;
dataSize = destLen; dataSize = destLen;
} }