Memory leak fix patch

Kiss Karoly karcsi at tvnetwork.hu
Tue Aug 30 09:18:51 UTC 2005


Hello,

I am currently using asterisk on debian, and there is a memory leak in 
asterisk which only shows in very extreme conditions, but I had the luck 
to run into it and I managed to make a patch for debian, see the attached 
file.
Please note that the patch was done after doing a debian/rules patch in 
the downloaded asterisk sources.
The bug was originally fixed by the asterisk developers, and was 
backported to the 1.0 stable branch but it seems that in the debian 
sources the problem still exists. I used that patch to create the one I 
attached since the original one cannot be applied.

See http://bugs.digium.com/view.php?id=4318

I hope this helps.

Thank you,

Kiss Karoly
-------------- next part --------------
--- apps/app_queue.c.orig	2005-08-30 10:55:15.000000000 +0200
+++ apps/app_queue.c	2005-08-30 10:55:24.000000000 +0200
@@ -861,21 +861,30 @@
 			if (!f || ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP))) {
 				/* Got hung up */
 				*to=-1;
+				if ( f )
+					ast_frfree(f);
 				return NULL;
 			}
-			if (f && (f->frametype == AST_FRAME_DTMF) && allowdisconnect_out && (f->subclass == '*')) {
+			if ((f->frametype == AST_FRAME_DTMF) && allowdisconnect_out && (f->subclass == '*')) {
 			    if (option_verbose > 3)
 					ast_verbose(VERBOSE_PREFIX_3 "User hit %c to disconnect call.\n", f->subclass);
 				*to=0;
+				if ( f )
+					ast_frfree(f);
 				return NULL;
 			}
-			if (f && (f->frametype == AST_FRAME_DTMF) && (f->subclass != '*') && valid_exit(qe, f->subclass)) {
+			if ((f->frametype == AST_FRAME_DTMF) && (f->subclass != '*') && valid_exit(qe, f->subclass)) {
 				if (option_verbose > 3)
 					ast_verbose(VERBOSE_PREFIX_3 "User pressed digit: %c", f->subclass);
 				*to=0;
 				*digit=f->subclass;
+				if ( f )
+					ast_frfree(f);
 				return NULL;
 			}
+			if ( f )
+				ast_frfree(f);
+
 		}
 		if (!*to && (option_verbose > 2))
 			ast_verbose( VERBOSE_PREFIX_3 "Nobody picked up in %d ms\n", orig);


More information about the Pkg-voip-maintainers mailing list