[FFmpeg-devel] [PATCH] Fix the ffmpeg -rc_eq "foo" bug
Michael Niedermayer
michaelni
Sun Jul 13 19:01:31 CEST 2008
On Sun, Jul 13, 2008 at 06:36:09PM +0200, Stefano Sabatini wrote:
> Hi all, currently ffmpeg crashes when setting the option -rc_eq.
>
> There are currently two bugs involved, the first one:
>
> +++ libavcodec/opt.c (working copy)
> @@ -196,7 +196,7 @@
> }
>
> if(alloc){
> - av_free((void*)(((uint8_t*)obj) + o->offset));
> + av_free(*(void**)(((uint8_t*)obj) + o->offset));
> val= av_strdup(val);
> }
>
> this because obj + o->offset is a pointer to the location which
> contains the pointer to the string.
>
> The rc_eq string needs to be strdup()ed in
> avcodec_get_context_defaults2 since av_set_string2() may free that
> pointer when it sets again the rc_eq string, which issues a SIGSEGV if
> the string is static.
>
> Note also that there is a memleak here, the rc_eq set by
> avcodec_get_context_defaults2() or by av_set_string() has to be
> explicitly freed by the user before to free the AVCodecContext.
patches ok
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
No snowflake in an avalanche ever feels responsible. -- Voltaire
-------------- 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/20080713/e2160f87/attachment.pgp>
More information about the ffmpeg-devel
mailing list