summaryrefslogtreecommitdiff
path: root/libavformat/http.c
diff options
context:
space:
mode:
authorMicah Galizia <micahgalizia@gmail.com>2013-01-20 20:25:30 -0500
committerMichael Niedermayer <michaelni@gmx.at>2013-01-21 02:50:02 +0100
commitc8ea5ccd5db125e24d46c74339c64f9527d7a72e (patch)
treeaf7c520c22d9f43e07a29c44280c8aee617b3aa7 /libavformat/http.c
parent00cae86754ef93fd4fff8d33424ea6304b126a32 (diff)
fix memory leak on string reassign
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> Fixes CID968584 and CID968585
Diffstat (limited to 'libavformat/http.c')
-rw-r--r--libavformat/http.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/http.c b/libavformat/http.c
index 903cf4a108..0700eac815 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);
}
}