From: William King Date: Thu, 13 Jun 2013 00:01:56 +0000 (-0700) Subject: Make sure to cleanup event if there was a failure that caused it not to be fired. X-Git-Tag: v1.4.1~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5c60bd6b42c9706d8ca0ada0fa68eac6cc091e19;p=thirdparty%2Ffreeswitch.git Make sure to cleanup event if there was a failure that caused it not to be fired. --- diff --git a/src/mod/event_handlers/mod_erlang_event/handle_msg.c b/src/mod/event_handlers/mod_erlang_event/handle_msg.c index 75d6c20434..0dea52c0c3 100644 --- a/src/mod/event_handlers/mod_erlang_event/handle_msg.c +++ b/src/mod/event_handlers/mod_erlang_event/handle_msg.c @@ -766,6 +766,10 @@ static switch_status_t handle_msg_sendevent(listener_t *listener, int arity, ei_ ei_x_encode_atom(rbuf, "ok"); } } + /* If the event wasn't successfully fired, or failed for any other reason, then make sure not to leak it. */ + if ( event ) { + switch_event_destroy(&event) + } } } return SWITCH_STATUS_SUCCESS;