]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
gracefully handle allocation failure
authorMichael Jerris <mike@jerris.com>
Wed, 30 Apr 2014 12:55:39 +0000 (08:55 -0400)
committerMichael Jerris <mike@jerris.com>
Wed, 30 Apr 2014 12:55:39 +0000 (08:55 -0400)
src/mod/applications/mod_lcr/mod_lcr.c

index 53267d2049212358a7792ea851772f4b681fe0c0..1b3b6cd1eaf5e5befabb9b23929d5943418c9acc 100644 (file)
@@ -624,6 +624,12 @@ static int route_add_callback(void *pArg, int argc, char **argv, char **columnNa
        switch_memory_pool_t *pool = cbt->pool;
 
        additional = switch_core_alloc(pool, sizeof(lcr_obj_t));
+
+       if (!additional) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error allocating in route_add_callback\n");
+               goto end;
+       }
+
        switch_event_create(&additional->fields, SWITCH_EVENT_REQUEST_PARAMS);
 
        for (i = 0; i < argc ; i++) {