[FFmpeg-devel] [PATCH] Fix double free causing segmentation faults when accessing unavailable v4l devices
Michael Niedermayer
michaelni
Tue Jul 15 21:58:30 CEST 2008
On Tue, Jul 15, 2008 at 09:39:01PM +0200, Stefano Sabatini wrote:
> Hi all, as in subject,
> you may experience the crashes for example with:
> ffmpeg -f video4linux2 -s 640x480 -r 25 -i /dev/video0
>
> if there is no video4linux device connected to the machine (no
> /dev/video0 file).
>
> This happens because the v4l2?_read_header() functions call av_free() on
> the new stream, then av_open_input_stream() call av_free() again in case
> of failure on the already alloced stream:
>
> fail:
> if (ic) {
> int i;
> av_freep(&ic->priv_data);
> for(i=0;i<ic->nb_streams;i++) {
> AVStream *st = ic->streams[i];
> if (st) {
> av_free(st->priv_data);
> av_free(st->codec->extradata);
> }
> av_free(st);
> }
> }
> av_free(ic);
> *ic_ptr = NULL;
> return err;
>
> Another possible solution could be to use avfreep(&st) in
> v4l?.c, but I think this solution is more correct.
patches ok
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080715/ea76c606/attachment.pgp>
More information about the ffmpeg-devel
mailing list