From: Anthony Minessale Date: Wed, 22 Jan 2014 21:52:42 +0000 (+0500) Subject: remove double event crate, removing a memory leak in valet parking X-Git-Tag: v1.2.19~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=281434cdd60471953be56ed9f895403d907e4de2;p=thirdparty%2Ffreeswitch.git remove double event crate, removing a memory leak in valet parking --- diff --git a/src/mod/applications/mod_valet_parking/mod_valet_parking.c b/src/mod/applications/mod_valet_parking/mod_valet_parking.c index f14c81c3bf..95965d5529 100644 --- a/src/mod/applications/mod_valet_parking/mod_valet_parking.c +++ b/src/mod/applications/mod_valet_parking/mod_valet_parking.c @@ -805,24 +805,22 @@ static void pres_event_handler(switch_event_t *event) if (count) { if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { - if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", VALET_PROTO); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", lot_name); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", lot_name, domain_name); - - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "force-status", "Active (%d caller%s)", count, count == 1 ? "" : "s"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "active"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_count", "%d", EC++); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "unique-id", lot_name); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-state", "CS_ROUTING"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", "confirmed"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-direction", "inbound"); - switch_event_fire(&event); - } - found++; + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", VALET_PROTO); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", lot_name); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", lot_name, domain_name); + + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "force-status", "Active (%d caller%s)", count, count == 1 ? "" : "s"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "active"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog"); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_count", "%d", EC++); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "unique-id", lot_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-state", "CS_ROUTING"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", "confirmed"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-direction", "inbound"); + switch_event_fire(&event); } + found++; } else { if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", VALET_PROTO);