[vlc-devel] [PATCH 1/2] httplive: fix Read func. (when caller skips data)
Jean-Baptiste Kempf
jb at videolan.org
Wed Feb 1 12:13:45 CET 2012
On Tue, Jan 31, 2012 at 01:32:22PM +0100, Frederic YHUEL wrote :
> - memcpy(p_read + copied, segment->data->p_buffer, len);
> + if( p_read ) /* otherwise caller skips data */
> + memcpy(p_read + copied, segment->data->p_buffer, len);
The code seems wrong if hls_read can be called with p_read at NULL.
Use assert then.
> - if (buffer == NULL)
> - {
> - /* caller skips data, get big enough buffer */
> - msg_Warn(s, "buffer is NULL (allocate %d)", i_read);
> - buffer = calloc(1, i_read);
> - if (buffer == NULL)
> - return 0; /* NO MEMORY left*/
> - }
What guarrantees us that the buffer will not be NULL ?
Best regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
More information about the vlc-devel
mailing list