[MPlayer-dev-eng] [PATCH] cddb crash
Reimar Döffinger
Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Jan 19 18:03:43 CET 2008
Hello,
On Sat, Jan 19, 2008 at 05:34:05PM +0100, Reimar Döffinger wrote:
[...]
> > - cddb_data->xmcd_file = ptr;
> > - cddb_data->xmcd_file_size = ptr2-ptr+2;
> > + if ( (cddb_data->xmcd_file = malloc(ptr2 - ptr + 1)) == NULL)
> > + {
> > + mp_msg(MSGT_DEMUX,MSGL_FATAL,"Memory allocation failed\n");
> > + return -1;
> > + }
> > + memcpy(cddb_data->xmcd_file, ptr, ptr2 - ptr);
> > + cddb_data->xmcd_file_size = ptr2 - ptr;
>
> Possibly makes sense in order to avoid a hack, but
>
> > cddb_data->xmcd_file[cddb_data->xmcd_file_size] = '\0';
> > // Avoid the http_free function to free the xmcd file...save a mempcy...
> > http_hdr->body = NULL;
>
> With this it will leak memory.
Actually it will not, this is probably what caused your problems.
Anyway, fixed differently, but this file still scares me, it is strongly
in need of a review...
Greetings,
Reimar Döffinger
More information about the MPlayer-dev-eng
mailing list