diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-02-13 16:38:10 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-02-13 16:38:10 +0300 |
commit | 39c3ebdc910100a3194f62ac52af4e15a9422264 (patch) | |
tree | ab057fa4b8e7f7d9ac81dd845e34974fcbd34375 | |
parent | 4be8384e2798c2b3bc9fab4e04b7404bda152d5e (diff) |
fix for memory leak: node animation data wasnt being free'd
also some corrections to memory debug stuff.
-rw-r--r-- | intern/guardedalloc/intern/mallocn.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/node.c | 3 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 5 |
3 files changed, 9 insertions, 5 deletions
diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c index c90cbf65c4d..677d756c8e6 100644 --- a/intern/guardedalloc/intern/mallocn.c +++ b/intern/guardedalloc/intern/mallocn.c @@ -305,9 +305,9 @@ void *MEM_mallocN(unsigned int len, const char *str) memset(memh+1, 255, len); #ifdef DEBUG_MEMCOUNTER - memh->_count= _mallocn_count++; if(_mallocn_count==DEBUG_MEMCOUNTER_ERROR_VAL) memcount_raise("MEM_mallocN"); + memh->_count= _mallocn_count++; #endif return (++memh); } @@ -330,9 +330,9 @@ void *MEM_callocN(unsigned int len, const char *str) make_memhead_header(memh, len, str); mem_unlock_thread(); #ifdef DEBUG_MEMCOUNTER - memh->_count= _mallocn_count++; if(_mallocn_count==DEBUG_MEMCOUNTER_ERROR_VAL) memcount_raise("MEM_callocN"); + memh->_count= _mallocn_count++; #endif return (++memh); } @@ -372,9 +372,9 @@ void *MEM_mapallocN(unsigned int len, const char *str) mmap_in_use += len; mem_unlock_thread(); #ifdef DEBUG_MEMCOUNTER - memh->_count= _mallocn_count++; if(_mallocn_count==DEBUG_MEMCOUNTER_ERROR_VAL) memcount_raise("MEM_mapallocN"); + memh->_count= _mallocn_count++; #endif return (++memh); } diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 3a8f3565f14..0f3dc4b1a5a 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -57,6 +57,7 @@ #include "BKE_texture.h" #include "BKE_text.h" #include "BKE_utildefines.h" +#include "BKE_animsys.h" /* BKE_free_animdata only */ #include "BLI_math.h" #include "BLI_blenlib.h" @@ -1343,6 +1344,8 @@ void ntreeFreeTree(bNodeTree *ntree) ntreeEndExecTree(ntree); /* checks for if it is still initialized */ + BKE_free_animdata((ID *)ntree); + BLI_freelistN(&ntree->links); /* do first, then unlink_node goes fast */ for(node= ntree->nodes.first; node; node= next) { diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 79649f61750..5c2fcf7aee5 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -5307,7 +5307,7 @@ static BHead *read_data_into_oldnewmap(FileData *fd, BHead *bhead, char *allocna while(bhead && bhead->code==DATA) { void *data; -#if 0 +#if 0 /* XXX DUMB DEBUGGING OPTION TO GIVE NAMES for guarded malloc errors */ short *sp= fd->filesdna->structs[bhead->SDNAnr]; char *allocname = fd->filesdna->types[ sp[0] ]; @@ -5315,8 +5315,9 @@ static BHead *read_data_into_oldnewmap(FileData *fd, BHead *bhead, char *allocna strcpy(tmp, allocname); data= read_struct(fd, bhead, tmp); -#endif +#else data= read_struct(fd, bhead, allocname); +#endif if (data) { oldnewmap_insert(fd->datamap, bhead->old, data, 0); |