fix [#30220] Knife Tool Leaks memory
authorCampbell Barton <ideasman42@gmail.com>
Fri, 17 Feb 2012 05:33:23 +0000 (05:33 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 17 Feb 2012 05:33:23 +0000 (05:33 +0000)
both crash and leak are fixed now.

source/blender/blenlib/intern/smallhash.c
source/blender/editors/mesh/knifetool.c

index aaa518d3e1c8f5f7e1fda3aff28518f057f824fb..fb03849bfb3cf2ecf35f2137eb6d8fd3ba69c5bb 100644 (file)
@@ -88,7 +88,7 @@ void BLI_smallhash_insert(SmallHash *hash, uintptr_t key, void *item)
                int i = 0;
 
                if (hash->table != hash->stacktable || newsize > SMSTACKSIZE) {
-                       tmp = MEM_callocN(sizeof(*hash->table) * newsize, "new hashkeys");
+                       tmp = MEM_callocN(sizeof(*hash->table) * newsize, __func__);
                }
                else {
                        SWAP(SmallHashEntry *, hash->stacktable, hash->copytable);
index 257c23cc0dbda682b71947265358d38069193148..8e56a3574874783615d87905b18241ce2cf7b26c 100755 (executable)
@@ -1680,6 +1680,8 @@ static void remerge_faces(knifetool_opdata *kcd)
        /* bm->elem_index_dirty &= ~BM_FACE; */
        bm->elem_index_dirty |= BM_FACE;
 
+       BLI_smallhash_release(visit);
+
        BLI_array_free(stack);
        BLI_array_free(faces);
 }