Free already saved password when storing a new one

This shouldn't happen (clients aren't allowed to send more than one PASS
command), but who knows ...
This commit is contained in:
Alexander Barton 2012-08-26 19:05:08 +02:00
parent be97fa8ab1
commit 1680ea02da
1 changed files with 4 additions and 0 deletions

View File

@ -932,6 +932,10 @@ GLOBAL void
Conn_SetPassword( CONN_ID Idx, const char *Pwd )
{
assert( Idx > NONE );
if (My_Connections[Idx].pwd)
free(My_Connections[Idx].pwd);
My_Connections[Idx].pwd = strdup(Pwd);
if (My_Connections[Idx].pwd == NULL) {
Log(LOG_EMERG, "Can't allocate memory! [Conn_SetPassword]");