[brlcad-commits] SF.net SVN: brlcad:[40974] brlcad/trunk/src/librt/primitives/nmg/nmg_mk.c
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <r_...@us...> - 2010-10-13 16:33:49
|
Revision: 40974 http://brlcad.svn.sourceforge.net/brlcad/?rev=40974&view=rev Author: r_weiss Date: 2010-10-13 16:33:42 +0000 (Wed, 13 Oct 2010) Log Message: ----------- Within function nmg_je ?\226?\128?\156nmg join edge?\226?\128?\157 instead of freeing the source edge inside nmg_je, the edge is marked so the calling function can free the edge. The source edge does not always need to be freed, it depends on if it is still referenced by something else. It is necessary to only mark the edge to be freed since some calling functions are checking if the edge has been freed by checking if the magic is zero. These calling function are basing logic on values in freed memory which is undefined. Either the logic in the calling functions should be changed or do not free the edge within nmg_je, let the calling function free the edge. For now, let the calling function free the edge. Modified Paths: -------------- brlcad/trunk/src/librt/primitives/nmg/nmg_mk.c Modified: brlcad/trunk/src/librt/primitives/nmg/nmg_mk.c =================================================================== --- brlcad/trunk/src/librt/primitives/nmg/nmg_mk.c 2010-10-13 14:35:59 UTC (rev 40973) +++ brlcad/trunk/src/librt/primitives/nmg/nmg_mk.c 2010-10-13 16:33:42 UTC (rev 40974) @@ -2876,8 +2876,13 @@ eusrc->radial_p->radial_p = eusrc_mate->radial_p; eusrc_mate->radial_p->radial_p = eusrc->radial_p; } else { - /* this is the only use of the eusrc edge. Kill edge. */ - FREE_EDGE(e); + /* this is the only use of the eusrc edge. kill/free edge but not + * here. the edge should be freed by the calling function which can + * determine this edge should be freed by its edgeuse pointer + * pointing to itself and the magic number set to zero. + */ + e->eu_p = (struct edgeuse *)e; + e->magic = 0; } eusrc->radial_p = eudst; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |