FS-9401: [core,mod_amqp] fix leak in usage of hash itterator

This commit is contained in:
Michael Jerris 2016-08-03 18:41:18 -05:00
parent eebc2d9148
commit 9030e13589
3 changed files with 7 additions and 3 deletions

View File

@ -94,12 +94,13 @@ switch_status_t mod_amqp_logging_recv(const switch_log_node_t *node, switch_log_
if (switch_queue_trypush(logging->send_queue, msg) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "AMQP logging message queue full. Messages will be dropped!\n");
return SWITCH_STATUS_SUCCESS;
switch_safe_free(hi);
goto done;
}
}
}
done:
switch_safe_free(json);
return SWITCH_STATUS_SUCCESS;
}

View File

@ -2752,6 +2752,7 @@ static void unsub_all_switch_event_channel(void)
free(head);
}
switch_safe_free(hi);
switch_thread_rwlock_unlock(event_channel_manager.rwlock);
}

View File

@ -1039,7 +1039,7 @@ SWITCH_DECLARE(uint32_t) switch_jb_pop_nack(switch_jb_t *jb)
top:
for (hi = switch_core_hash_first(jb->missing_seq_hash); hi; hi = switch_core_hash_next(&hi)) {
for (hi = switch_core_hash_first_iter(jb->missing_seq_hash, hi); hi; hi = switch_core_hash_next(&hi)) {
uint16_t seq;
//const char *token;
switch_time_t then = 0;
@ -1076,6 +1076,8 @@ SWITCH_DECLARE(uint32_t) switch_jb_pop_nack(switch_jb_t *jb)
}
}
switch_safe_free(hi);
if (least && switch_core_inthash_delete(jb->missing_seq_hash, (uint32_t)htons(least))) {
jb_debug(jb, 3, "Found NACKABLE seq %u\n", least);
nack = (uint32_t) htons(least);