--- conn.c 2004-12-22 18:37:41.000000000 +0100 +++ conn-fw.c 2005-01-16 17:55:25.850117616 +0100 @@ -1012,30 +1012,15 @@ return; } - /* zunaechst realloc() versuchen; wenn das scheitert, malloc() versuchen - * und Daten ggf. "haendisch" umkopieren. (Haesslich! Eine wirklich - * dynamische Verwaltung waere wohl _deutlich_ besser ...) */ ptr = (POINTER *)realloc( My_Connections, sizeof( CONNECTION ) * new_size ); if( ! ptr ) { - /* realloc() ist fehlgeschlagen. Nun malloc() probieren: */ - ptr = (POINTER *)malloc( sizeof( CONNECTION ) * new_size ); - if( ! ptr ) - { - /* Offenbar steht kein weiterer Sepeicher zur Verfuegung :-( */ - Log( LOG_EMERG, "Can't allocate memory! [New_Connection]" ); - Simple_Message( new_sock, "ERROR: Internal error" ); - close( new_sock ); - return; - } - - /* Struktur umkopieren ... */ - memcpy( ptr, My_Connections, sizeof( CONNECTION ) * Pool_Size ); - -#ifdef DEBUG - Log( LOG_DEBUG, "Allocated new connection pool for %ld items (%ld bytes). [malloc()/memcpy()]", new_size, sizeof( CONNECTION ) * new_size ); -#endif + Log( LOG_EMERG, "Can't allocate memory! [New_Connection]" ); + Simple_Message( new_sock, "ERROR: Internal error" ); + close( new_sock ); + return; } + #ifdef DEBUG else Log( LOG_DEBUG, "Allocated new connection pool for %ld items (%ld bytes). [realloc()]", new_size, sizeof( CONNECTION ) * new_size ); #endif