Fix T99744: NULL pointer free with corrupt zSTD reading

This commit is contained in:
Campbell Barton 2022-07-16 16:32:36 +10:00
parent bf49e6040c
commit f76b537d48
Notes: blender-bot 2023-02-14 06:23:08 +01:00
Referenced by issue #99744, blender-thumbnailer null pointer reference and free
Referenced by issue #98661, 3.2: Potential candidates for corrective releases
1 changed files with 4 additions and 1 deletions

View File

@ -281,7 +281,10 @@ static void zstd_close(FileReader *reader)
if (zstd->reader.seek) {
MEM_freeN(zstd->seek.uncompressed_ofs);
MEM_freeN(zstd->seek.compressed_ofs);
MEM_freeN(zstd->seek.cached_content);
/* When an error has occurred this may be NULL, see: T99744. */
if (zstd->seek.cached_content) {
MEM_freeN(zstd->seek.cached_content);
}
}
else {
MEM_freeN((void *)zstd->in_buf.src);