[Bf-blender-cvs] [f76b537d486] master: Fix T99744: NULL pointer free with corrupt zSTD reading
Campbell Barton
noreply at git.blender.org
Sat Jul 16 08:35:17 CEST 2022
Commit: f76b537d486029fc8ad5bf3bf9b122bc4b3c9d89
Author: Campbell Barton
Date: Sat Jul 16 16:32:36 2022 +1000
Branches: master
https://developer.blender.org/rBf76b537d486029fc8ad5bf3bf9b122bc4b3c9d89
Fix T99744: NULL pointer free with corrupt zSTD reading
===================================================================
M source/blender/blenlib/intern/filereader_zstd.c
===================================================================
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);
More information about the Bf-blender-cvs
mailing list