]> arthur.barton.de Git - ngircd-alex.git/commitdiff
Free already saved password when storing a new one
authorAlexander Barton <alex@barton.de>
Sun, 26 Aug 2012 17:05:08 +0000 (19:05 +0200)
committerAlexander Barton <alex@barton.de>
Sun, 26 Aug 2012 17:07:38 +0000 (19:07 +0200)
This shouldn't happen (clients aren't allowed to send more than one PASS
command), but who knows ...

src/ngircd/conn.c

index 46a3ecc2caefe0c1dc5fe41754357aadc08db128..e7bf1db891cba610e4737a4e5f8347e5ff732a36 100644 (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]");