diff --git a/src/mod/event_handlers/mod_amqp/mod_amqp.c b/src/mod/event_handlers/mod_amqp/mod_amqp.c index dfb32f0a28..a481064975 100644 --- a/src/mod/event_handlers/mod_amqp/mod_amqp.c +++ b/src/mod/event_handlers/mod_amqp/mod_amqp.c @@ -88,12 +88,12 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_amqp_shutdown) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Mod starting shutting down\n"); switch_event_unbind_callback(mod_amqp_producer_event_handler); - for (hi = switch_core_hash_first(globals.producer_hash); hi; hi = switch_core_hash_next(&hi)) { + while ((hi = switch_core_hash_first(globals.producer_hash))) { switch_core_hash_this(hi, NULL, NULL, (void **)&producer); mod_amqp_producer_destroy(&producer); } - for (hi = switch_core_hash_first(globals.command_hash); hi; hi = switch_core_hash_next(&hi)) { + while ((hi = switch_core_hash_first(globals.command_hash))) { switch_core_hash_this(hi, NULL, NULL, (void **)&command); mod_amqp_command_destroy(&command); } diff --git a/src/mod/event_handlers/mod_amqp/mod_amqp_producer.c b/src/mod/event_handlers/mod_amqp/mod_amqp_producer.c index 1bb344f270..dd649495d7 100644 --- a/src/mod/event_handlers/mod_amqp/mod_amqp_producer.c +++ b/src/mod/event_handlers/mod_amqp/mod_amqp_producer.c @@ -311,6 +311,7 @@ switch_status_t mod_amqp_producer_create(char *name, switch_xml_t cfg) if ( mod_amqp_connection_open(profile->conn_root, &(profile->conn_active), profile->name, profile->custom_attr) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile[%s] was unable to connect to any connection\n", profile->name); + goto err; } amqp_exchange_declare(profile->conn_active->state, 1,