Revision: 78050
          http://sourceforge.net/p/brlcad/code/78050
Author:   starseeker
Date:     2021-01-07 14:04:33 +0000 (Thu, 07 Jan 2021)
Log Message:
-----------
Clean up rtip

Modified Paths:
--------------
    brlcad/trunk/src/libanalyze/raydiff.c

Modified: brlcad/trunk/src/libanalyze/raydiff.c
===================================================================
--- brlcad/trunk/src/libanalyze/raydiff.c       2021-01-07 01:47:56 UTC (rev 
78049)
+++ brlcad/trunk/src/libanalyze/raydiff.c       2021-01-07 14:04:33 UTC (rev 
78050)
@@ -195,7 +195,7 @@
     fastf_t oldtime, currtime;
     int ind = 0;
     int count = 0;
-    struct rt_i *rtip;
+    struct rt_i *rtip = NULL;
     int ncpus = bu_avail_cpus();
     fastf_t *rays;
     struct rt_gen_worker_vars *state = (struct rt_gen_worker_vars 
*)bu_calloc(ncpus+1, sizeof(struct rt_gen_worker_vars ), "state");
@@ -250,8 +250,14 @@
     }
 #endif
 #if 1
-    if (rt_gettree(rtip, left) < 0) return -1;
-    if (rt_gettree(rtip, right) < 0) return -1;
+    if (rt_gettree(rtip, left) < 0) {
+       rt_free_rti(rtip);
+       return -1;
+    }
+    if (rt_gettree(rtip, right) < 0) {
+       rt_free_rti(rtip);
+       return -1;
+    }
 #endif
 
     rt_prep_parallel(rtip, ncpus);
@@ -340,6 +346,9 @@
     bu_free(state, "free state containers");
     bu_free(local_state, "free state containers");
     bu_free(resp, "free resources");
+    if (rtip) {
+       rt_free_rti(rtip);
+    }
 
     return ret;
 }

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



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to