[FFmpeg-devel] x11grab.c: minor clean up, added more documentation

Michael Niedermayer michaelni at gmx.at
Fri Apr 8 18:16:48 CEST 2011


On Fri, Apr 01, 2011 at 03:56:45PM +0000, Carl Eugen Hoyos wrote:
> Sven C. Dack <sven.c.dack <at> virginmedia.com> writes:
> 
> > >> +    av_free(x11grab->dpyname);
> > >>      
> > > So I guess my solution, to free param immediately after the call to
> > > XOpenDisplay(), was wrong
> > >    
> > What are you talking about?
> 
> I had the following (inlined) patch in my local tree since I applied "Remove a
> memory allocation and the associated memcpy.".
> 
> diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c
> index 6a674ee..b8fcd1a 100644
> --- a/libavdevice/x11grab.c
> +++ b/libavdevice/x11grab.c
> @@ -106,5 +106,6 @@
> 
>      dpy = XOpenDisplay(param);
> +    av_free(param);
>      if(!dpy) {
>          av_log(s1, AV_LOG_ERROR, "Could not open X display.\n");
>          return AVERROR(EIO);
> 
> I have no idea if it is correct, but it fixed the memleak for me (and does not
> crash here).
> Is it wrong?

i applied it, if its wrong then so are other projects also ive not
found a document that said the string has to be preserved until point
X.
Maybe someone who knows x11 api could clarify this

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Frequently ignored awnser#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110408/9210ca22/attachment.asc>


More information about the ffmpeg-devel mailing list