Commit c8ea5ccd authored by Micah Galizia's avatar Micah Galizia Committed by Michael Niedermayer

fix memory leak on string reassign

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
Fixes CID968584 and CID968585
parent 00cae867
...@@ -406,8 +406,10 @@ static int get_cookies(HTTPContext *s, char **cookies, const char *path, ...@@ -406,8 +406,10 @@ static int get_cookies(HTTPContext *s, char **cookies, const char *path,
while ((param = av_strtok(cookie, "; ", &next_param))) { while ((param = av_strtok(cookie, "; ", &next_param))) {
cookie = NULL; cookie = NULL;
if (!av_strncasecmp("path=", param, 5)) { if (!av_strncasecmp("path=", param, 5)) {
av_free(cpath);
cpath = av_strdup(&param[5]); cpath = av_strdup(&param[5]);
} else if (!av_strncasecmp("domain=", param, 7)) { } else if (!av_strncasecmp("domain=", param, 7)) {
av_free(cdomain);
cdomain = av_strdup(&param[7]); cdomain = av_strdup(&param[7]);
} else if (!av_strncasecmp("secure", param, 6) || } else if (!av_strncasecmp("secure", param, 6) ||
!av_strncasecmp("comment", param, 7) || !av_strncasecmp("comment", param, 7) ||
...@@ -415,6 +417,7 @@ static int get_cookies(HTTPContext *s, char **cookies, const char *path, ...@@ -415,6 +417,7 @@ static int get_cookies(HTTPContext *s, char **cookies, const char *path,
!av_strncasecmp("version", param, 7)) { !av_strncasecmp("version", param, 7)) {
// ignore Comment, Max-Age, Secure and Version // ignore Comment, Max-Age, Secure and Version
} else { } else {
av_free(cvalue);
cvalue = av_strdup(param); cvalue = av_strdup(param);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment