]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
remove double event crate, removing a memory leak in valet parking
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 22 Jan 2014 21:52:42 +0000 (02:52 +0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 22 Jan 2014 21:52:58 +0000 (02:52 +0500)
src/mod/applications/mod_valet_parking/mod_valet_parking.c

index f14c81c3bf087958ed9dff73a2cff1212674b0a6..95965d55292310c59f138ae27972cdba17b3b034 100644 (file)
@@ -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);