[Bf-blender-cvs] [f15fecf0f70] master: Readfile: avoid confusion when debugging a memory leak

Jacques Lucke noreply at git.blender.org
Fri Sep 9 13:16:44 CEST 2022


Commit: f15fecf0f701758b7cc4d9bf2d50153aed2cc8c8
Author: Jacques Lucke
Date:   Fri Sep 9 13:16:13 2022 +0200
Branches: master
https://developer.blender.org/rBf15fecf0f701758b7cc4d9bf2d50153aed2cc8c8

Readfile: avoid confusion when debugging a memory leak

===================================================================

M	source/blender/blenloader/intern/readfile.c

===================================================================

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 506595fd6fe..bf2017b80f4 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3065,7 +3065,11 @@ static BHead *read_data_into_datamap(FileData *fd, BHead *bhead, const char *all
      * With the code below we get the struct-name to help tracking down the leak.
      * This is kept disabled as the #malloc for the text always leaks memory. */
 #if 0
-    {
+    if (bhead->SDNAnr == 0) {
+      /* The data type here is unclear because #writedata sets SDNAnr to 0. */
+      allocname = "likely raw data";
+    }
+    else {
       SDNA_Struct *sp = fd->filesdna->structs[bhead->SDNAnr];
       allocname = fd->filesdna->types[sp->type];
       size_t allocname_size = strlen(allocname) + 1;



More information about the Bf-blender-cvs mailing list