From: Mark Michelson Date: Fri, 10 May 2013 20:41:44 +0000 (+0000) Subject: Fix memory leak in pbx_dundi X-Git-Tag: 11.5.0-rc1~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c28267b7e122fb2511dcfbbfff455d92a395d7c;p=thirdparty%2Fasterisk.git Fix memory leak in pbx_dundi pbx_dundi added an io context without removing it. This caused a memory leak when the module was unloaded. (closes ASTERISK-21718) Reported by Corey Farrell Patches: pbx_dundi-ast_io_remove.patch uploaded by Corey Farrell (License #5909) ........ Merged revisions 388376 from http://svn.asterisk.org/svn/asterisk/branches/1.8 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@388378 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c index 61f06962b9..e7abf0c835 100644 --- a/pbx/pbx_dundi.c +++ b/pbx/pbx_dundi.c @@ -2169,7 +2169,7 @@ static void *network_thread(void *ignore) from the network, and queue them for delivery to the channels */ int res; /* Establish I/O callback for socket read */ - ast_io_add(io, netsocket, socket_read, AST_IO_IN, NULL); + int *socket_read_id = ast_io_add(io, netsocket, socket_read, AST_IO_IN, NULL); while (!dundi_shutdown) { res = ast_sched_wait(sched); @@ -2184,6 +2184,7 @@ static void *network_thread(void *ignore) check_password(); } + ast_io_remove(io, socket_read_id); netthreadid = AST_PTHREADT_NULL; return NULL;