mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-17 01:02:12 +00:00
FS-8950 fix a few memory leaks in mod_skinny
This commit is contained in:
parent
095e1f7bf2
commit
da91717b8e
@ -320,7 +320,7 @@ void skinny_line_get(listener_t *listener, uint32_t instance, struct line_stat_r
|
|||||||
switch_assert(listener->profile);
|
switch_assert(listener->profile);
|
||||||
switch_assert(listener->device_name);
|
switch_assert(listener->device_name);
|
||||||
|
|
||||||
helper.button = switch_core_alloc(listener->pool, sizeof(struct line_stat_res_message));
|
helper.button = calloc(sizeof(struct line_stat_res_message),1);
|
||||||
|
|
||||||
if ((sql = switch_mprintf(
|
if ((sql = switch_mprintf(
|
||||||
"SELECT '%d' AS wanted_position, position, label, value, caller_name "
|
"SELECT '%d' AS wanted_position, position, label, value, caller_name "
|
||||||
@ -363,7 +363,7 @@ void skinny_speed_dial_get(listener_t *listener, uint32_t instance, struct speed
|
|||||||
switch_assert(listener->profile);
|
switch_assert(listener->profile);
|
||||||
switch_assert(listener->device_name);
|
switch_assert(listener->device_name);
|
||||||
|
|
||||||
helper.button = switch_core_alloc(listener->pool, sizeof(struct speed_dial_stat_res_message));
|
helper.button = calloc(sizeof(struct speed_dial_stat_res_message),1);
|
||||||
|
|
||||||
if ((sql = switch_mprintf(
|
if ((sql = switch_mprintf(
|
||||||
"SELECT '%d' AS wanted_position, position, label, value, settings "
|
"SELECT '%d' AS wanted_position, position, label, value, settings "
|
||||||
@ -407,7 +407,7 @@ void skinny_service_url_get(listener_t *listener, uint32_t instance, struct serv
|
|||||||
switch_assert(listener->profile);
|
switch_assert(listener->profile);
|
||||||
switch_assert(listener->device_name);
|
switch_assert(listener->device_name);
|
||||||
|
|
||||||
helper.button = switch_core_alloc(listener->pool, sizeof(struct service_url_stat_res_message));
|
helper.button = calloc(sizeof(struct service_url_stat_res_message), 1);
|
||||||
|
|
||||||
if ((sql = switch_mprintf(
|
if ((sql = switch_mprintf(
|
||||||
"SELECT '%d' AS wanted_position, position, label, value, settings "
|
"SELECT '%d' AS wanted_position, position, label, value, settings "
|
||||||
@ -453,7 +453,7 @@ void skinny_feature_get(listener_t *listener, uint32_t instance, struct feature_
|
|||||||
switch_assert(listener->profile);
|
switch_assert(listener->profile);
|
||||||
switch_assert(listener->device_name);
|
switch_assert(listener->device_name);
|
||||||
|
|
||||||
helper.button = switch_core_alloc(listener->pool, sizeof(struct feature_stat_res_message));
|
helper.button = calloc(sizeof(struct feature_stat_res_message), 1);
|
||||||
|
|
||||||
if ((sql = switch_mprintf(
|
if ((sql = switch_mprintf(
|
||||||
"SELECT '%d' AS wanted_position, position, label, value, settings "
|
"SELECT '%d' AS wanted_position, position, label, value, settings "
|
||||||
|
@ -116,6 +116,9 @@ switch_status_t skinny_create_incoming_session(listener_t *listener, uint32_t *l
|
|||||||
|
|
||||||
if (!button || !button->shortname[0]) {
|
if (!button || !button->shortname[0]) {
|
||||||
skinny_log_l(listener, SWITCH_LOG_CRIT, "Line %d not found on device\n", *line_instance_p);
|
skinny_log_l(listener, SWITCH_LOG_CRIT, "Line %d not found on device\n", *line_instance_p);
|
||||||
|
if ( button ) {
|
||||||
|
switch_safe_free(button);
|
||||||
|
}
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,11 +202,17 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
listener->profile->ib_failed_calls++;
|
listener->profile->ib_failed_calls++;
|
||||||
|
if ( button ) {
|
||||||
|
switch_safe_free(button);
|
||||||
|
}
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
*session = nsession;
|
*session = nsession;
|
||||||
listener->profile->ib_calls++;
|
listener->profile->ib_calls++;
|
||||||
|
if ( button ) {
|
||||||
|
switch_safe_free(button);
|
||||||
|
}
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1524,6 +1533,7 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess
|
|||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
skinny_session_process_dest(session, listener, line_instance, button_speed_dial->line, '\0', 0);
|
skinny_session_process_dest(session, listener, line_instance, button_speed_dial->line, '\0', 0);
|
||||||
|
switch_safe_free(button_speed_dial);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SKINNY_BUTTON_HOLD:
|
case SKINNY_BUTTON_HOLD:
|
||||||
@ -1582,10 +1592,12 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess
|
|||||||
skinny_create_incoming_session(listener, &line_instance, &session);
|
skinny_create_incoming_session(listener, &line_instance, &session);
|
||||||
if ( ! session ) {
|
if ( ! session ) {
|
||||||
skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle stimulus message, couldn't create incoming session.\n");
|
skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle stimulus message, couldn't create incoming session.\n");
|
||||||
|
switch_safe_free(button_line);
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
skinny_session_process_dest(session, listener, line_instance, NULL, '\0', 0);
|
skinny_session_process_dest(session, listener, line_instance, NULL, '\0', 0);
|
||||||
}
|
}
|
||||||
|
switch_safe_free(button_line);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1709,6 +1721,8 @@ switch_status_t skinny_handle_speed_dial_stat_request(listener_t *listener, skin
|
|||||||
|
|
||||||
send_speed_dial_stat_res(listener, request->data.speed_dial_req.number, button->line, button->label);
|
send_speed_dial_stat_res(listener, request->data.speed_dial_req.number, button->line, button->label);
|
||||||
|
|
||||||
|
switch_safe_free(button);
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1725,6 +1739,8 @@ switch_status_t skinny_handle_line_stat_request(listener_t *listener, skinny_mes
|
|||||||
|
|
||||||
memcpy(&message->data.line_res, button, sizeof(struct line_stat_res_message));
|
memcpy(&message->data.line_res, button, sizeof(struct line_stat_res_message));
|
||||||
|
|
||||||
|
switch_safe_free(button);
|
||||||
|
|
||||||
skinny_send_reply(listener, message, SWITCH_TRUE);
|
skinny_send_reply(listener, message, SWITCH_TRUE);
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
@ -2407,6 +2423,8 @@ switch_status_t skinny_handle_service_url_stat_request(listener_t *listener, ski
|
|||||||
|
|
||||||
skinny_send_reply(listener, message, SWITCH_TRUE);
|
skinny_send_reply(listener, message, SWITCH_TRUE);
|
||||||
|
|
||||||
|
switch_safe_free(button);
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2425,6 +2443,8 @@ switch_status_t skinny_handle_feature_stat_request(listener_t *listener, skinny_
|
|||||||
|
|
||||||
skinny_send_reply(listener, message, SWITCH_TRUE);
|
skinny_send_reply(listener, message, SWITCH_TRUE);
|
||||||
|
|
||||||
|
switch_safe_free(button);
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2568,7 +2588,7 @@ switch_status_t skinny_handle_updatecapabilities(listener_t *listener, skinny_me
|
|||||||
}
|
}
|
||||||
i = 0;
|
i = 0;
|
||||||
pos = 0;
|
pos = 0;
|
||||||
codec_string = switch_core_alloc(listener->pool, string_len+1);
|
codec_string = calloc(string_len+1, 1);
|
||||||
for (string_pos = 0; string_pos < string_len; string_pos++) {
|
for (string_pos = 0; string_pos < string_len; string_pos++) {
|
||||||
char *codec = codec_order[i];
|
char *codec = codec_order[i];
|
||||||
switch_assert(i < n);
|
switch_assert(i < n);
|
||||||
@ -2591,6 +2611,7 @@ switch_status_t skinny_handle_updatecapabilities(listener_t *listener, skinny_me
|
|||||||
}
|
}
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||||
"Codecs %s supported.\n", codec_string);
|
"Codecs %s supported.\n", codec_string);
|
||||||
|
switch_safe_free(codec_string);
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user