提交 ee6f3da9 authored 作者: William King's avatar William King

CID: 1211948 fix memory leak of decoded iks message in function…

CID: 1211948 fix memory leak of decoded iks message in function parse_plain_auth_message in mod_rayo
上级 2a50bbba
...@@ -46,16 +46,16 @@ void parse_plain_auth_message(const char *message, char **authzid, char **authci ...@@ -46,16 +46,16 @@ void parse_plain_auth_message(const char *message, char **authzid, char **authci
*authcid = NULL; *authcid = NULL;
*password = NULL; *password = NULL;
if (decoded == NULL) { if (decoded == NULL) {
return; goto end;
} }
pos = strlen(decoded) + 1; pos = strlen(decoded) + 1;
if (pos >= maxlen) { if (pos >= maxlen) {
return; goto end;
} }
*authcid = strdup(decoded + pos); *authcid = strdup(decoded + pos);
pos += strlen(*authcid) + 1; pos += strlen(*authcid) + 1;
if (pos >= maxlen) { if (pos >= maxlen) {
return; goto end;
} }
*password = strdup(decoded + pos); *password = strdup(decoded + pos);
if (zstr(decoded)) { if (zstr(decoded)) {
...@@ -63,7 +63,9 @@ void parse_plain_auth_message(const char *message, char **authzid, char **authci ...@@ -63,7 +63,9 @@ void parse_plain_auth_message(const char *message, char **authzid, char **authci
} else { } else {
*authzid = strdup(decoded); *authzid = strdup(decoded);
} }
free(decoded);
end:
switch_safe_free(decoded);
} }
/* For Emacs: /* For Emacs:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论