From: <bc...@us...> - 2007-11-01 15:23:41
|
Revision: 1254 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1254&view=rev Author: bcholew Date: 2007-11-01 08:23:44 -0700 (Thu, 01 Nov 2007) Log Message: ----------- Document ownership of memory returned by iaxc_video_devices_get(). Properly cleanup vidcap device lists on shutdown. Modified Paths: -------------- trunk/lib/iaxclient.h trunk/lib/video.c Modified: trunk/lib/iaxclient.h =================================================================== --- trunk/lib/iaxclient.h 2007-11-01 14:22:18 UTC (rev 1253) +++ trunk/lib/iaxclient.h 2007-11-01 15:23:44 UTC (rev 1254) @@ -1134,9 +1134,14 @@ EXPORT int iaxc_set_audio_prefs(unsigned int prefs); /*! - Get video capture device information: + Get video capture device information. + WARNING: the array pointed to by parameter 'devs' below is owned + by iaxclient, and may be freed on subsequent calls to + this function. \param devs Returns an array of iaxc_video_device structures. - The array will will be valid as long as iaxc is initialized. + The array will only be valid until this function is + called again (if the device list changes), or until + iaxc is shutdown. \param nDevs Returns the number of devices in the devs array \param devId Returns the id of the currently selected video capture device Modified: trunk/lib/video.c =================================================================== --- trunk/lib/video.c 2007-11-01 14:22:18 UTC (rev 1253) +++ trunk/lib/video.c 2007-11-01 15:23:44 UTC (rev 1254) @@ -1639,9 +1639,19 @@ int video_destroy(void) { + int i; + if ( !vinfo.vc ) return -1; + free(vinfo.vc_src_info); + for ( i = 0; i < vinfo.device_count; i++ ) + { + free((void *)vinfo.devices[i].name); + free((void *)vinfo.devices[i].id_string); + } + free(vinfo.devices); + vidcap_destroy(vinfo.vc); vinfo.vc = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |