[asterisk-commits] branch 1.2 r29696 - /branches/1.2/res/res_features.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue May 23 08:58:25 MST 2006


Author: bweschke
Date: Tue May 23 10:58:24 2006
New Revision: 29696

URL: http://svn.digium.com/view/asterisk?rev=29696&view=rev
Log:
 Fix a potential leak and correct (hopefully) a segfault under certain conditions. #6784 (vovan and perry testing)


Modified:
    branches/1.2/res/res_features.c

Modified: branches/1.2/res/res_features.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/res/res_features.c?rev=29696&r1=29695&r2=29696&view=diff
==============================================================================
--- branches/1.2/res/res_features.c (original)
+++ branches/1.2/res/res_features.c Tue May 23 10:58:24 2006
@@ -1433,6 +1433,9 @@
 				featurecode = peer_featurecode;
 			}
 			featurecode[strlen(featurecode)] = f->subclass;
+			/* Get rid of the frame before we start doing "stuff" with the channels */
+			ast_frfree(f);
+			f = NULL;
 			config->feature_timer = backup_config.feature_timer;
 			res = ast_feature_interpret(chan, peer, config, featurecode, sense);
 			switch(res) {
@@ -1445,10 +1448,8 @@
 			}
 			if (res >= FEATURE_RETURN_PASSDIGITS) {
 				res = 0;
-			} else {
-				ast_frfree(f);
+			} else 
 				break;
-			}
 			hasfeatures = !ast_strlen_zero(chan_featurecode) || !ast_strlen_zero(peer_featurecode);
 			if (hadfeatures && !hasfeatures) {
 				/* Restore backup */



More information about the asterisk-commits mailing list