[asterisk-commits] murf: branch 1.4 r140670 - in /branches/1.4/main: channel.c pbx.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 2 17:15:57 CDT 2008


Author: murf
Date: Tue Sep  2 17:15:57 2008
New Revision: 140670

URL: http://svn.digium.com/view/asterisk?view=rev&rev=140670
Log:
(closes issue #13409)
Reported by: tomaso
Patches:
      asterisk-1.6.0-rc2-cdrmemleak.patch uploaded by tomaso (license 564)

I basically spent the day, verifying that this patch 
solves the problem, and doesn't hurt in non-problem 
cases. Why valgrind did not plainly reveal this leak
absolutely mystifies and stuns me. 

Many, many thanks to tomaso for finding and providing the fix.



Modified:
    branches/1.4/main/channel.c
    branches/1.4/main/pbx.c

Modified: branches/1.4/main/channel.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/channel.c?view=diff&rev=140670&r1=140669&r2=140670
==============================================================================
--- branches/1.4/main/channel.c (original)
+++ branches/1.4/main/channel.c Tue Sep  2 17:15:57 2008
@@ -1277,6 +1277,11 @@
 
 	/* Destroy the jitterbuffer */
 	ast_jb_destroy(chan);
+
+	if (chan->cdr) {
+		ast_cdr_free(chan->cdr);
+		chan->cdr = NULL;
+	}
 	
 	ast_mutex_destroy(&chan->lock);
 
@@ -1523,6 +1528,7 @@
 			
 		ast_cdr_end(chan->cdr);
 		ast_cdr_detach(chan->cdr);
+		chan->cdr = NULL;
 	}
 	
 	ast_channel_free(chan);

Modified: branches/1.4/main/pbx.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/pbx.c?view=diff&rev=140670&r1=140669&r2=140670
==============================================================================
--- branches/1.4/main/pbx.c (original)
+++ branches/1.4/main/pbx.c Tue Sep  2 17:15:57 2008
@@ -4972,6 +4972,7 @@
 	ast_cdr_end(chan->cdr);
 	ast_cdr_failed(chan->cdr);      /* set the status to failed */
 	ast_cdr_detach(chan->cdr);      /* post and free the record */
+	chan->cdr = NULL;
 	ast_channel_free(chan);         /* free the channel */
 
 	return 0;  /* success */




More information about the asterisk-commits mailing list