From: Alexander Barton Date: Sun, 26 Aug 2012 17:05:08 +0000 (+0200) Subject: Free already saved password when storing a new one X-Git-Tag: rel-20-rc1~104^2~1 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=commitdiff_plain;h=1680ea02da10dff49748214f6e01538808c7ee65 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 ... --- diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c index 46a3ecc2..e7bf1db8 100644 --- a/src/ngircd/conn.c +++ b/src/ngircd/conn.c @@ -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]");