[FFmpeg-cvslog] fix memory leak on string reassign

Micah Galizia git at videolan.org
Mon Jan 21 02:55:56 CET 2013


ffmpeg | branch: master | Micah Galizia <micahgalizia at gmail.com> | Sun Jan 20 20:25:30 2013 -0500| [c8ea5ccd5db125e24d46c74339c64f9527d7a72e] | committer: Michael Niedermayer

fix memory leak on string reassign

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
Fixes CID968584 and CID968585

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c8ea5ccd5db125e24d46c74339c64f9527d7a72e
---

 libavformat/http.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/http.c b/libavformat/http.c
index 903cf4a..0700eac 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -406,8 +406,10 @@ static int get_cookies(HTTPContext *s, char **cookies, const char *path,
         while ((param = av_strtok(cookie, "; ", &next_param))) {
             cookie = NULL;
             if        (!av_strncasecmp("path=",   param, 5)) {
+                av_free(cpath);
                 cpath = av_strdup(&param[5]);
             } else if (!av_strncasecmp("domain=", param, 7)) {
+                av_free(cdomain);
                 cdomain = av_strdup(&param[7]);
             } else if (!av_strncasecmp("secure",  param, 6) ||
                        !av_strncasecmp("comment", param, 7) ||
@@ -415,6 +417,7 @@ static int get_cookies(HTTPContext *s, char **cookies, const char *path,
                        !av_strncasecmp("version", param, 7)) {
                 // ignore Comment, Max-Age, Secure and Version
             } else {
+                av_free(cvalue);
                 cvalue = av_strdup(param);
             }
         }



More information about the ffmpeg-cvslog mailing list