Hi,
there seems to be a memory leak in New_Connection() (src/ngircd/conn.c), line 1044:
1018 ptr = (POINTER *)realloc( My_Connections, sizeof( CONNECTION ) * new_size ); 1019 if( ! ptr ) 1020 { 1021 /* realloc() ist fehlgeschlagen. Nun malloc() probieren: */ 1022 ptr = (POINTER *)malloc( sizeof( CONNECTION ) * new_size ); 1023 if( ! ptr ) 1024 { 1025 /* Offenbar steht kein weiterer Sepeicher zur Verfuegung :-( */ 1026 Log( LOG_EMERG, "Can't allocate memory! [New_Connection]" ); 1027 Simple_Message( new_sock, "ERROR: Internal error" ); 1028 close( new_sock ); 1029 return; 1030 } 1031 1032 /* Struktur umkopieren ... */ 1033 memcpy( ptr, My_Connections, sizeof( CONNECTION ) * Pool_Size );
[..] Debug ommitted...
1038 } 1043 /* Adjust pointer to new block */ 1044 My_Connections = (CONNECTION *)ptr;
"My_Connections" gets overwritten, without calling free(). For the sake of simplicity I'd rather remove the malloc() call altogether. The attached patch does just that.
Florian