Revision: 56707
          http://sourceforge.net/p/brlcad/code/56707
Author:   r_weiss
Date:     2013-08-08 22:43:09 +0000 (Thu, 08 Aug 2013)
Log Message:
-----------
Fixed some memory free errors when raytracing with bot-tie.

Modified Paths:
--------------
    brlcad/trunk/src/librt/primitives/bot/tie_kdtree.c

Modified: brlcad/trunk/src/librt/primitives/bot/tie_kdtree.c
===================================================================
--- brlcad/trunk/src/librt/primitives/bot/tie_kdtree.c  2013-08-08 22:06:10 UTC 
(rev 56706)
+++ brlcad/trunk/src/librt/primitives/bot/tie_kdtree.c  2013-08-08 22:43:09 UTC 
(rev 56707)
@@ -124,9 +124,13 @@
        tie_kdtree_free_node(&((struct tie_kdtree_s 
*)(((intptr_t)(node_aligned->data)) & ~0x7L))[1]);
     } else {
        /* This node points to a geometry node, free it */
-       bu_free(((struct tie_geom_s *)((intptr_t)(node_aligned->data) & 
~0x7L))->tri_list, "tri_list");
+       struct tie_geom_s *tmp;
+       tmp = (struct tie_geom_s *)((intptr_t)(node_aligned->data) & ~0x7L);
+       if (tmp->tri_num > 0) {
+           bu_free(tmp->tri_list, "tri_list");
+       }
+       bu_free(tmp, "data");
     }
-    bu_free((void*)((intptr_t)(node_aligned->data) & ~0x7L), "data");
 }
 
 static void

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to