From: William King Date: Wed, 7 May 2014 07:44:54 +0000 (-0700) Subject: CID: 1211948 fix memory leak of decoded iks message in function parse_plain_auth_mess... X-Git-Tag: v1.5.12~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee6f3da9ff965995937f21def9d84dc6ffb6464f;p=thirdparty%2Ffreeswitch.git CID: 1211948 fix memory leak of decoded iks message in function parse_plain_auth_message in mod_rayo --- diff --git a/src/mod/event_handlers/mod_rayo/sasl.c b/src/mod/event_handlers/mod_rayo/sasl.c index be794330cd..c93146d13b 100644 --- a/src/mod/event_handlers/mod_rayo/sasl.c +++ b/src/mod/event_handlers/mod_rayo/sasl.c @@ -46,16 +46,16 @@ void parse_plain_auth_message(const char *message, char **authzid, char **authci *authcid = NULL; *password = NULL; if (decoded == NULL) { - return; + goto end; } pos = strlen(decoded) + 1; if (pos >= maxlen) { - return; + goto end; } *authcid = strdup(decoded + pos); pos += strlen(*authcid) + 1; if (pos >= maxlen) { - return; + goto end; } *password = strdup(decoded + pos); if (zstr(decoded)) { @@ -63,7 +63,9 @@ void parse_plain_auth_message(const char *message, char **authzid, char **authci } else { *authzid = strdup(decoded); } - free(decoded); + + end: + switch_safe_free(decoded); } /* For Emacs: