Module: ngircd.git Branch: master Commit: 1680ea02da10dff49748214f6e01538808c7ee65 URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=1680e...
Author: Alexander Barton alex@barton.de Date: Sun Aug 26 19:05:08 2012 +0200
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 ...
---
src/ngircd/conn.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c index 46a3ecc..e7bf1db 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]");