[Mplayer-cvslog] CVS: main codec-cfg.c, 1.111, 1.112 codec-cfg.h, 1.70, 1.71
Sascha Sommer CVS
syncmail at mplayerhq.hu
Sat Oct 30 12:09:55 CEST 2004
CVS change done by Sascha Sommer CVS
Update of /cvsroot/mplayer/main
In directory mail:/var2/tmp/cvs-serv2966
Modified Files:
codec-cfg.c codec-cfg.h
Log Message:
Memory Free function Fix, based on patch by Wei Jiang <jiangw98 at yahoo.com>
Index: codec-cfg.c
===================================================================
RCS file: /cvsroot/mplayer/main/codec-cfg.c,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -r1.111 -r1.112
--- codec-cfg.c 12 Oct 2004 11:29:20 -0000 1.111
+++ codec-cfg.c 30 Oct 2004 10:09:52 -0000 1.112
@@ -487,11 +487,7 @@
int tmp, i;
// in case we call it a second time
- if(video_codecs!=NULL)free(video_codecs);
- video_codecs=NULL;
-
- if(audio_codecs!=NULL)free(audio_codecs);
- audio_codecs=NULL;
+ codecs_uninit_free();
nr_vcodecs = 0;
nr_acodecs = 0;
@@ -715,12 +711,7 @@
err_out_print_linenum:
PRINT_LINENUM;
err_out:
- if (audio_codecs)
- free(audio_codecs);
- if (video_codecs)
- free(video_codecs);
- video_codecs=NULL;
- audio_codecs=NULL;
+ codecs_uninit_free();
free(line);
line=NULL;
@@ -735,6 +726,32 @@
goto err_out_print_linenum;
}
+static void codecs_free(codecs_t* codecs,int count) {
+ int i;
+ for ( i = 0; i < count; i++)
+ if ( (codecs[i]).name ) {
+ if( (codecs[i]).name )
+ free((codecs[i]).name);
+ if( (codecs[i]).info )
+ free((codecs[i]).info);
+ if( (codecs[i]).comment )
+ free((codecs[i]).comment);
+ if( (codecs[i]).dll )
+ free((codecs[i]).dll);
+ if( (codecs[i]).drv )
+ free((codecs[i]).drv);
+ }
+ if (codecs)
+ free(codecs);
+}
+
+void codecs_uninit_free() {
+ codecs_free(video_codecs,nr_vcodecs);
+ video_codecs=NULL;
+ codecs_free(audio_codecs,nr_acodecs);
+ audio_codecs=NULL;
+}
+
codecs_t *find_audio_codec(unsigned int fourcc, unsigned int *fourccmap,
codecs_t *start)
{
Index: codec-cfg.h
===================================================================
RCS file: /cvsroot/mplayer/main/codec-cfg.h,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- codec-cfg.h 9 Oct 2004 07:38:45 -0000 1.70
+++ codec-cfg.h 30 Oct 2004 10:09:52 -0000 1.71
@@ -65,5 +65,6 @@
void select_codec(char* codecname,int audioflag);
void list_codecs(int audioflag);
void codecs_reset_selection(int audioflag);
+void codecs_uninit_free();
#endif
More information about the MPlayer-cvslog
mailing list