Re: [FFmpeg-devel] [PATCH] libavformat/ftp: Do not leak memory in routine ftp_features

2014-08-21 Thread Alexander Strasser
On 2014-08-20 06:27 +0200, Alexander Strasser wrote:
> On 2014-08-20 01:25 +0200, Alexander Strasser wrote:
> > Should fix CID1231988 (RESOURCE_LEAK)
> > 
> > Signed-off-by: Alexander Strasser 
> > ---
> > 
> > WARNING: Sorry, I only compile-tested so far.
> > 
> >   There is one remaining thing, I am not sure of:
> > It looks like the variable feet could be uninitialized
> > at the point av_freep is called. I think it cannot, but
> > I had to follow quite some hops down the call hierarchy.
> > 
> >  I see two possibilities for taking care of that:
> > 
> >  1) explicitly initialize it with NULL (could be merged with declaration)
> >  2) someone else goes all the way down and if he comes to the same 
> > conclusion
> > as I did, we add a comment stating that to ftp_send_command
> 
>After sleeping over it I think I am wrong about 2 because
> ftp_send_command may early return and in those cases leave feat
> uninitialized.
> 
>So here is some more:
> 
>   3) Examine all places ftp_send_command, ftp_status is called
>  and do what described for this instance in point 1
>   4) Change ftp_send_command and ftp_status to make sure the
>  out parameter is always valid or at least NULL after a call
> 
>   Doing 4 seem best to me ATM but maybe I missed some things again :(

  Dropped.

  I sent v2 which combines points 1, 3 and 4.

https://ffmpeg.org/pipermail/ffmpeg-devel/2014-August/161668.html
Subject: [FFmpeg-devel] [PATCH v2] libavformat/ftp: Do not leak memory in 
routine ftp_features
Message-ID: 



  Alexander


pgpihp_luxi5_.pgp
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavformat/ftp: Do not leak memory in routine ftp_features

2014-08-19 Thread Alexander Strasser
On 2014-08-20 01:25 +0200, Alexander Strasser wrote:
> Should fix CID1231988 (RESOURCE_LEAK)
> 
> Signed-off-by: Alexander Strasser 
> ---
> 
> WARNING: Sorry, I only compile-tested so far.
> 
>   There is one remaining thing, I am not sure of:
> It looks like the variable feet could be uninitialized
> at the point av_freep is called. I think it cannot, but
> I had to follow quite some hops down the call hierarchy.
> 
>  I see two possibilities for taking care of that:
> 
>  1) explicitly initialize it with NULL (could be merged with declaration)
>  2) someone else goes all the way down and if he comes to the same conclusion
> as I did, we add a comment stating that to ftp_send_command

   After sleeping over it I think I am wrong about 2 because
ftp_send_command may early return and in those cases leave feat
uninitialized.

   So here is some more:

  3) Examine all places ftp_send_command, ftp_status is called
 and do what described for this instance in point 1
  4) Change ftp_send_command and ftp_status to make sure the
 out parameter is always valid or at least NULL after a call

  Doing 4 seem best to me ATM but maybe I missed some things again :(

  Alexander

>  libavformat/ftp.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavformat/ftp.c b/libavformat/ftp.c
> index 9ee9b16..4c071bf 100644
> --- a/libavformat/ftp.c
> +++ b/libavformat/ftp.c
> @@ -450,6 +450,7 @@ static int ftp_features(FTPContext *s)
>  if (av_stristr(feat, "UTF8"))
>  ftp_send_command(s, enable_utf8_command, opts_codes, NULL);
>  }
> +av_freep(&feat);
>  return 0;
>  }
>  
> -- 


pgpXz2NArbwef.pgp
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel