[GRASS-dev] possible memory leak in Nget_viewdir_cmd ()?

Ivan Shmakov oneingray at gmail.com
Tue Nov 11 11:51:48 EST 2008


	togl_flythrough.c reads:

--cut: http://svn.osgeo.org/grass/grass/trunk/visualization/nviz/src/togl_flythrough.c--
   901	int Nget_viewdir_cmd(Nv_data * data, Tcl_Interp * interp,	/* Current interpreter. */
   902			     int argc,	/* Number of arguments. */
   903			     char **argv	/* Argument strings. */
   904	    )
   905	{
...
   920	    Tcl_SetResult(interp, Tcl_Merge(3, list), TCL_VOLATILE);
   921	
   922	    return (TCL_OK);
   923	}
--cut: http://svn.osgeo.org/grass/grass/trunk/visualization/nviz/src/togl_flythrough.c--

	However:

--cut: Tcl_Merge(3tcl)--
      Tcl_Merge is the inverse of Tcl_SplitList: it takes a collection
      of strings given by argc and argv and generates a result string
      that has proper list structure.  [...]
      The result string is dynamically allocated using Tcl_Alloc; the
      caller must eventually release the space using Tcl_Free.
--cut: Tcl_Merge(3tcl)--

	Hence, it seems that TCL_DYNAMIC is to be used instead of the
	current TCL_VOLATILE.


More information about the grass-dev mailing list