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

Alexander Strasser eclipse7 at gmx.net
Wed Aug 20 01:25:53 CEST 2014

Should fix CID1231988 (RESOURCE_LEAK)

Signed-off-by: Alexander Strasser <eclipse7 at gmx.net>

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


 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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140820/dae6e693/attachment.asc>

More information about the ffmpeg-devel mailing list