Revision: 54438
          http://brlcad.svn.sourceforge.net/brlcad/?rev=54438&view=rev
Author:   brlcad
Date:     2013-02-20 05:07:30 +0000 (Wed, 20 Feb 2013)
Log Message:
-----------
quell a linux compilation failure warning about verts being potentially 
clobbered after a longjmp.  move the calloc/memset to after the BU_SETJUMP call 
and check for null before freeing verts.

Modified Paths:
--------------
    brlcad/trunk/src/conv/obj-g.c

Modified: brlcad/trunk/src/conv/obj-g.c
===================================================================
--- brlcad/trunk/src/conv/obj-g.c       2013-02-20 04:58:18 UTC (rev 54437)
+++ brlcad/trunk/src/conv/obj-g.c       2013-02-20 05:07:30 UTC (rev 54438)
@@ -2847,12 +2847,6 @@
     NMG_CK_REGION(r);
     NMG_CK_SHELL(s);
 
-    /* initialize tables */
-    bu_ptbl_init(&faces, 64, " &faces ");
-
-    verts = (struct vertex **)bu_calloc(gfi->tot_vertices, sizeof(struct 
vertex *), "verts");
-    memset((void *)verts, 0, sizeof(struct vertex *) * gfi->tot_vertices);
-
     /* begin bomb protection */
     if (BU_SETJUMP) {
        BU_UNSETJUMP; /* relinquish bomb protection */
@@ -2862,8 +2856,8 @@
         */
        rt_g.NMG_debug = NMG_debug; /* restore mode */
 
-       bu_ptbl_reset(&faces);
-       bu_free(verts, "verts");
+       if (verts)
+           bu_free(verts, "verts");
 
        if (m != (struct model *)NULL) {
            /* sanity check */
@@ -2876,6 +2870,12 @@
        return 2; /* return code 2 indicates nmg bomb occurred */
     }
 
+    /* initialize tables */
+    bu_ptbl_init(&faces, 64, " &faces ");
+
+    verts = (struct vertex **)bu_calloc(gfi->tot_vertices, sizeof(struct 
vertex *), "verts");
+    memset((void *)verts, 0, sizeof(struct vertex *) * gfi->tot_vertices);
+
     shell_vert_idx = 0;
     NMG_CK_SHELL(s);
     /* loop thru all the polygons (i.e. faces) to be placed in the current 
shell/region/model */

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


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to