[brlcad-commits] SF.net SVN: brlcad:[33275] brlcad/trunk/src/proc-db/spltest.c
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <br...@us...> - 2008-12-04 07:04:44
|
Revision: 33275 http://brlcad.svn.sourceforge.net/brlcad/?rev=33275&view=rev Author: brlcad Date: 2008-12-04 07:04:41 +0000 (Thu, 04 Dec 2008) Log Message: ----------- fix a memory deallocation error. since this is calling mk_export_fwrite directly (which is really just wdb_export()), it cannot use a rt_nurb_internal that is on the stack because ifree() ends up getting called on the internal during export. Modified Paths: -------------- brlcad/trunk/src/proc-db/spltest.c Modified: brlcad/trunk/src/proc-db/spltest.c =================================================================== --- brlcad/trunk/src/proc-db/spltest.c 2008-12-04 07:00:05 UTC (rev 33274) +++ brlcad/trunk/src/proc-db/spltest.c 2008-12-04 07:04:41 UTC (rev 33275) @@ -96,7 +96,7 @@ { point_t a, b, c, d; struct rt_wdb *fp; - struct rt_nurb_internal si; + struct rt_nurb_internal *si; char *filename; if (argc < 1 || argc > 2) { @@ -121,14 +121,15 @@ VSET(c, 10, 10, 0); VSET(d, 0, 10, 0); - si.magic = RT_NURB_INTERNAL_MAGIC; - si.nsrf = 0; - si.srfs = (struct face_g_snurb **)bu_malloc(sizeof(struct face_g_snurb *)*100, "allocate snurb ptrs"); + si = (struct rt_nurb_internal *)bu_malloc(sizeof(struct rt_nurb_internal), "spltest rt_nurb_internal"); + si->magic = RT_NURB_INTERNAL_MAGIC; + si->nsrf = 0; + si->srfs = (struct face_g_snurb **)bu_malloc(sizeof(struct face_g_snurb *)*100, "allocate snurb ptrs"); - make_face(&si, a, b, c, d, 2); + make_face(si, a, b, c, d, 2); /* wdb_export */ - mk_export_fwrite(fp, "spltest", (genptr_t)&si, ID_BSPLINE); + mk_export_fwrite(fp, "spltest", (genptr_t)si, ID_BSPLINE); return 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |