[asterisk-commits] irroot: branch irroot/t38gateway-1.8 r336157 - /team/irroot/t38gateway-1.8/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 15 14:28:06 CDT 2011


Author: irroot
Date: Thu Sep 15 14:28:04 2011
New Revision: 336157

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=336157
Log:
Changes to WaitFax free frames when queueing them preventing a leak

Modified:
    team/irroot/t38gateway-1.8/res/res_fax.c

Modified: team/irroot/t38gateway-1.8/res/res_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/t38gateway-1.8/res/res_fax.c?view=diff&rev=336157&r1=336156&r2=336157
==============================================================================
--- team/irroot/t38gateway-1.8/res/res_fax.c (original)
+++ team/irroot/t38gateway-1.8/res/res_fax.c Thu Sep 15 14:28:04 2011
@@ -3166,7 +3166,7 @@
 	int res = 0;
 	int dspnoise = 0;
 	struct ast_dsp *dsp = NULL;
-	struct ast_frame *f;
+	struct ast_frame *f, *dup_f;
 	enum ast_t38_state t38state = T38_STATE_UNKNOWN;
 	unsigned int orig_read_format;
 	AST_LIST_HEAD_NOLOCK(, ast_frame) deferred_frames;
@@ -3182,13 +3182,13 @@
 			}
 	}
 
-	if ((dsp = ast_dsp_new())) {
-		ast_dsp_set_features(dsp, DSP_FEATURE_FAX_DETECT);
-		ast_dsp_set_faxmode(dsp, DSP_FAXMODE_DETECT_CNG | DSP_FAXMODE_DETECT_SQUELCH);
-		ast_dsp_set_threshold(dsp, ast_dsp_get_threshold_from_settings(THRESHOLD_SILENCE));
-	} else {
+	if (!(dsp = ast_dsp_new())) {
 		return -1;
 	}
+
+	ast_dsp_set_features(dsp, DSP_FEATURE_FAX_DETECT);
+	ast_dsp_set_faxmode(dsp, DSP_FAXMODE_DETECT_CNG | DSP_FAXMODE_DETECT_SQUELCH);
+	ast_dsp_set_threshold(dsp, ast_dsp_get_threshold_from_settings(THRESHOLD_SILENCE));
 
 	AST_LIST_HEAD_INIT_NOLOCK(&deferred_frames);
 
@@ -3231,7 +3231,11 @@
 
 	ast_channel_lock(chan);
 	while ((f = AST_LIST_REMOVE_HEAD(&deferred_frames, frame_list))) {
-		ast_queue_frame_head(chan, ast_frisolate(f));
+		dup_f = ast_frisolate(f);
+		ast_queue_frame_head(chan, dup_f);
+		if (dup_f != f) {
+			ast_frfree(f);
+		}
 	}
 	ast_channel_unlock(chan);
 




More information about the asterisk-commits mailing list