Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-07-16 09:32:36 +0300
committerCampbell Barton <campbell@blender.org>2022-07-16 09:32:36 +0300
commitf76b537d486029fc8ad5bf3bf9b122bc4b3c9d89 (patch)
treeaa713d5f2fc02cdc7bc692c4e897e81348f7191c /source/blender/blenlib/intern/filereader_zstd.c
parentbf49e6040caac1e975982375731c348a1fcb11c1 (diff)
Fix T99744: NULL pointer free with corrupt zSTD reading
Diffstat (limited to 'source/blender/blenlib/intern/filereader_zstd.c')
-rw-r--r--source/blender/blenlib/intern/filereader_zstd.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/filereader_zstd.c b/source/blender/blenlib/intern/filereader_zstd.c
index 5f114f24fb0..aeb000e9754 100644
--- a/source/blender/blenlib/intern/filereader_zstd.c
+++ b/source/blender/blenlib/intern/filereader_zstd.c
@@ -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);