[MPlayer-cvslog] CVS: main/Gui interface.c,1.102,1.103

Guillaume POIRIER guillaume.poirier at etudiant.univ-rennes1.fr
Mon Jan 31 20:47:16 CET 2005


Hi,
Le lundi 31 janvier 2005 à 19:16 +0100, Reimar D?finger CVS a écrit : 
> CVS change done by Reimar Döffinger CVS
> 
> Update of /cvsroot/mplayer/main/Gui
> In directory mail:/var2/tmp/cvs-serv8765
> 
> Modified Files:
> 	interface.c 
> Log Message:
> Yet another memleak...
> 
> 
> Index: interface.c
> ===================================================================
> RCS file: /cvsroot/mplayer/main/Gui/interface.c,v
> retrieving revision 1.102
> retrieving revision 1.103
> diff -u -r1.102 -r1.103
> --- interface.c	6 Jan 2005 18:10:36 -0000	1.102
> +++ interface.c	31 Jan 2005 18:16:39 -0000	1.103
> @@ -842,8 +842,9 @@
>  	  tmp = calloc( 1,strlen( gtkAOOSSDevice ) + 7 );
>  	  sprintf( tmp,"oss:%s",gtkAOOSSDevice );
>  	  } else
> -	    tmp = "oss";
> +	    tmp = strdup("oss");
>  	  gaddlist( &audio_driver_list,tmp );
> +	  free(tmp);
>  	 }


Is that really only what it takes to have a memleak?
'cause when I run:
find -name "*.c" -type f -exec grep -q "= \"" {} \; -print
I catch lots of those, just like in libavformat/audio.c, line 52:
   if (!audio_device)
        audio_device = "/dev/dsp";

So there, it should read 
   if (!audio_device)
        audio_device = strdup("/dev/dsp");

and later free(audio_device) or is that just okay here as audio_device
is provided by the caller, which should take care of that?

... just trying to help... I'm quite confident that that lots of those
are perfectly legal, or you'd have fixed them already... ;-)

Regards,

Guillaume




More information about the MPlayer-cvslog mailing list