]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Don't create a new memory pool until it's clear we actually need it.
authorAndrew Thompson <andrew@hijacked.us>
Fri, 7 Nov 2008 03:21:19 +0000 (03:21 +0000)
committerAndrew Thompson <andrew@hijacked.us>
Fri, 7 Nov 2008 03:21:19 +0000 (03:21 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10281 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c

index 861eda978fbe18f3e2eba0048f8ef1f8831dfa48..ac89597bd568b1876551f7dfe5271e8a2e2cf8e8 100644 (file)
@@ -1191,11 +1191,6 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_erlang_event_runtime)
        switch_log_bind_logger(socket_logger, SWITCH_LOG_DEBUG, SWITCH_FALSE);
 
        for (;;) {
-               if (switch_core_new_memory_pool(&listener_pool) != SWITCH_STATUS_SUCCESS) {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "OH OH no pool\n");
-                       goto fail;
-               }
-
                /* zero out errno because ei_accept doesn't differentiate between a
                 * failed authentication or a socket failure, or a client version
                 * mismatch or a godzilla attack */
@@ -1216,6 +1211,11 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_erlang_event_runtime)
                        break;
                }
 
+               if (switch_core_new_memory_pool(&listener_pool) != SWITCH_STATUS_SUCCESS) {
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "OH OH no pool\n");
+                       goto fail;
+               }
+
                if (!(listener = switch_core_alloc(listener_pool, sizeof(*listener)))) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error\n");
                        break;