Fix memory leaks in PASS command, both in normal and repeated use.

This commit is contained in:
Elly 2010-06-01 13:11:47 -04:00
parent e70448e441
commit 86ed11bb4c
1 changed files with 9 additions and 2 deletions

View File

@ -67,9 +67,16 @@ mr_pass(struct Client *client_p, struct Client *source_p, int parc, const char *
memset(client_p->localClient->passwd, 0, memset(client_p->localClient->passwd, 0,
strlen(client_p->localClient->passwd)); strlen(client_p->localClient->passwd));
rb_free(client_p->localClient->passwd); rb_free(client_p->localClient->passwd);
client_p->localClient->passwd = NULL;
} }
client_p->localClient->passwd = rb_strndup(parv[1], PASSWDLEN); if (client_p->localClient->auth_user)
{
memset(client_p->localClient->auth_user, 0,
strlen(client_p->localClient->auth_user));
rb_free(client_p->localClient->auth_user);
client_p->localClient->auth_user = NULL;
}
if ((pass = strchr(buf, ':')) != NULL) if ((pass = strchr(buf, ':')) != NULL)
{ {