# HG changeset patch # User reimar # Date 1097684579 0 # Node ID b633ce0aa5c5d719bda2e8fdf7459b5aaa9f26e4 # Parent e6f34ebeb40dd9756aa15ddd63245a2457be895f fixed small memleaks diff -r e6f34ebeb40d -r b633ce0aa5c5 libao2/audio_out.c --- 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){ diff -r e6f34ebeb40d -r b633ce0aa5c5 libvo/font_load_ft.c --- 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) {