@@ -1785,7 +1785,6 @@ static int ministream_save(MSI_DIRENT *dirent, BIO *outdata, MSI_OUT *out)
17851785 dirent -> entry -> startSectorLocation = out -> sectorNum ;
17861786 /* ministream save */
17871787 BIO_write (outdata , out -> ministream , (int )out -> miniStreamLen );
1788- OPENSSL_free (out -> ministream );
17891788 /* fill to the end with known data, such as all zeroes */
17901789 if (out -> miniStreamLen % out -> sectorSize > 0 ) {
17911790 remain = out -> sectorSize - out -> miniStreamLen % out -> sectorSize ;
@@ -2186,6 +2185,8 @@ static int msiout_set(MSI_FILE *msi, uint32_t len_msi, uint32_t len_msiex, MSI_O
21862185 out -> header = header_new (msi -> m_hdr , out );
21872186 out -> minifatMemallocCount = msi -> m_hdr -> numMiniFATSector ;
21882187 out -> fatMemallocCount = msi -> m_hdr -> numFATSector ;
2188+ out -> difatMemallocCount = 0 ;
2189+ out -> difat = NULL ;
21892190 out -> ministream = NULL ;
21902191 out -> minifat = OPENSSL_malloc ((uint64_t )out -> minifatMemallocCount * out -> sectorSize );
21912192 out -> fat = OPENSSL_malloc ((uint64_t )out -> fatMemallocCount * out -> sectorSize );
@@ -2226,7 +2227,9 @@ static int msi_file_write(MSI_FILE *msi, MSI_DIRENT *dirent, u_char *p_msi, uint
22262227out :
22272228 OPENSSL_free (out .header );
22282229 OPENSSL_free (out .fat );
2230+ OPENSSL_free (out .difat );
22292231 OPENSSL_free (out .minifat );
2232+ OPENSSL_free (out .ministream );
22302233 return ret ;
22312234}
22322235
0 commit comments