[Freeswitch-svn] [commit] r9329 - in freeswitch/trunk/src: . mod/event_handlers/mod_event_socket
Freeswitch SVN
anthm at freeswitch.org
Wed Aug 20 15:10:05 EDT 2008
Author: anthm
Date: Wed Aug 20 15:10:04 2008
New Revision: 9329
Modified:
freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
freeswitch/trunk/src/switch_event.c
Log:
fix some mem leaks
Modified: freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c Wed Aug 20 15:10:04 2008
@@ -1115,7 +1115,7 @@
char reply[512] = "";
switch_core_session_t *session = NULL;
switch_channel_t *channel = NULL;
-
+ switch_event_t *revent = NULL;
switch_mutex_lock(listen_list.mutex);
prefs.threads++;
@@ -1234,8 +1234,6 @@
}
while (switch_test_flag(listener, LFLAG_RUNNING) && listen_list.ready) {
- switch_event_t *revent;
-
len = sizeof(buf);
memset(buf, 0, len);
status = read_packet(listener, &revent, 0);
@@ -1253,6 +1251,8 @@
break;
}
+ switch_event_destroy(&revent);
+
if (*reply != '\0') {
if (*reply == '~') {
switch_snprintf(buf, sizeof(buf), "Content-Type: command/reply\n%s", reply + 1);
@@ -1266,6 +1266,10 @@
}
done:
+
+ if (revent) {
+ switch_event_destroy(&revent);
+ }
remove_listener(listener);
Modified: freeswitch/trunk/src/switch_event.c
==============================================================================
--- freeswitch/trunk/src/switch_event.c (original)
+++ freeswitch/trunk/src/switch_event.c Wed Aug 20 15:10:04 2008
@@ -1093,7 +1093,11 @@
EVENT_NODES[n->event_id] = n->next;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Event Binding deleted for %s:%s\n", n->id, switch_event_name(n->event_id));
- n->subclass = NULL;
+ if (n->subclass) {
+ FREE(n->subclass->owner);
+ FREE(n->subclass->name);
+ FREE(n->subclass);
+ }
FREE(n->id);
FREE(n);
status = SWITCH_STATUS_SUCCESS;
More information about the Freeswitch-svn
mailing list