diff --git a/src/mod/applications/mod_hiredis/mod_hiredis.c b/src/mod/applications/mod_hiredis/mod_hiredis.c index 09a538e15a..2af3cd3598 100644 --- a/src/mod/applications/mod_hiredis/mod_hiredis.c +++ b/src/mod/applications/mod_hiredis/mod_hiredis.c @@ -197,13 +197,14 @@ SWITCH_LIMIT_RELEASE(hiredis_limit_release) while (tmp) { profile = switch_core_hash_find(mod_hiredis_globals.profiles, limit_pvt->realm); hashkey = switch_mprintf("decr %s", tmp->limit_key); - limit_pvt = tmp->next; if ( limit_pvt && (limit_pvt->interval > 0) && (hiredis_profile_execute_sync(profile, hashkey, &response) != SWITCH_STATUS_SUCCESS)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "hiredis: profile[%s] error executing [%s] because [%s]\n", tmp->realm, hashkey, response); } + limit_pvt = tmp->next; + tmp = limit_pvt; switch_safe_free(response); switch_safe_free(hashkey);