[Mplayer-cvslog] CVS: main/libmpcodecs ad_realaud.c,1.23,1.24

D Richard Felker III dalias at aerifal.cx
Mon May 12 19:10:13 CEST 2003


On Mon, May 12, 2003 at 05:51:14PM +0200, Alex Beregszaszi wrote:
> Update of /cvsroot/mplayer/main/libmpcodecs
> In directory mail:/var/tmp.root/cvs-serv1326
> 
> Modified Files:
> 	ad_realaud.c 
> Log Message:
> use dynamic path[] allocation and possible better wraSetDLLAccessPath mechanism :)
> 
> Index: ad_realaud.c
> ===================================================================
> RCS file: /cvsroot/mplayer/main/libmpcodecs/ad_realaud.c,v
> retrieving revision 1.23
> retrieving revision 1.24
> diff -u -r1.23 -r1.24
> --- ad_realaud.c	11 May 2003 17:58:02 -0000	1.23
> +++ ad_realaud.c	12 May 2003 15:50:40 -0000	1.24
> @@ -211,8 +211,10 @@
>    unsigned int result;
>    int len=0;
>    void* prop;
> -  char path[4096];
> +  char *path;
>  
> +  path = malloc(strlen(REALCODEC_PATH)+strlen(sh->codec->dll)+2);
> +  if (!path) return 0;

You don't need to change this....but haven't we agreed that checking
malloc return is ugly and pointless?

>    sprintf(path, REALCODEC_PATH "/%s", sh->codec->dll);
>  
>      /* first try to load linux dlls, if failed and we're supporting win32 dlls,
> @@ -226,6 +228,7 @@
>      {
>  	mp_msg(MSGT_DECVIDEO, MSGL_ERR, MSGTR_MissingDLLcodec, sh->codec->dll);
>  	mp_msg(MSGT_DECVIDEO, MSGL_HINT, "Read the RealAudio section of the DOCS!\n");
> +	free(path);
>  	return 0;
>      }
>  
> @@ -234,7 +237,9 @@
>  #else
>    if(raSetDLLAccessPath){
>  #endif
> +      int i;
>        // used by 'SIPR'
> +      path = realloc(path, strlen(REALCODEC_PATH) + 12);

And here later you don't check it anyway.

Rich



More information about the MPlayer-cvslog mailing list