Mercurial > mplayer.hg
changeset 13632:b633ce0aa5c5
fixed small memleaks
author | reimar |
---|---|
date | Wed, 13 Oct 2004 16:22:59 +0000 |
parents | e6f34ebeb40d |
children | 1952baa5cd51 |
files | libao2/audio_out.c libvo/font_load_ft.c |
diffstat | 2 files changed, 20 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/libao2/audio_out.c Wed Oct 13 09:58:50 2004 +0000 +++ b/libao2/audio_out.c Wed Oct 13 16:22:59 2004 +0000 @@ -137,20 +137,26 @@ // first try the preferred drivers, with their optional subdevice param: if(ao_list && ao_list[0]) while(ao_list[0][0]){ - char* ao=strdup(ao_list[0]); + char* ao=ao_list[0]; + int ao_len; if (strncmp(ao, "alsa9", 5) == 0 || strncmp(ao, "alsa1x", 6) == 0) { mp_msg(MSGT_AO, MSGL_FATAL, MSGTR_AO_ALSA9_1x_Removed); - free(ao); exit_player(NULL); } + if (ao_subdevice) { + free(ao_subdevice); + ao_subdevice = NULL; + } ao_subdevice=strchr(ao,':'); if(ao_subdevice){ - ao_subdevice[0]=0; - ++ao_subdevice; + ao_len = ao_subdevice - ao; + ao_subdevice = strdup(&ao[ao_len + 1]); } + else + ao_len = strlen(ao); for(i=0;audio_out_drivers[i];i++){ ao_functions_t* audio_out=audio_out_drivers[i]; - if(!strcmp(audio_out->info->short_name,ao)){ + if(!strncmp(audio_out->info->short_name,ao,ao_len)){ // name matches, try it if(use_plugin){ audio_out_plugin.control(AOCONTROL_SET_PLUGIN_DRIVER,audio_out); @@ -161,12 +167,14 @@ } } // continue... - free(ao); ++ao_list; if(!(ao_list[0])) return NULL; // do NOT fallback to others } + if (ao_subdevice) { + free(ao_subdevice); + ao_subdevice = NULL; + } // now try the rest... - ao_subdevice=NULL; for(i=0;audio_out_drivers[i];i++){ ao_functions_t* audio_out=audio_out_drivers[i]; if(use_plugin){
--- a/libvo/font_load_ft.c Wed Oct 13 09:58:50 2004 +0000 +++ b/libvo/font_load_ft.c Wed Oct 13 16:22:59 2004 +0000 @@ -882,10 +882,12 @@ if (desc->pic_a[i]) { if (desc->pic_a[i]->bmp) free(desc->pic_a[i]->bmp); if (desc->pic_a[i]->pal) free(desc->pic_a[i]->pal); + free (desc->pic_a[i]); } if (desc->pic_b[i]) { if (desc->pic_b[i]->bmp) free(desc->pic_b[i]->bmp); if (desc->pic_b[i]->pal) free(desc->pic_b[i]->pal); + free (desc->pic_b[i]); } } @@ -909,7 +911,9 @@ if (name) err = FT_New_Face(library, name, 0, face); if (err) { - err = FT_New_Face(library, get_path("subfont.ttf"), 0, face); + char *font_file = get_path("subfont.ttf"); + err = FT_New_Face(library, font_file, 0, face); + free(font_file); if (err) { err = FT_New_Face(library, MPLAYER_DATADIR "/subfont.ttf", 0, face); if (err) {