[asterisk-commits] irroot: branch irroot/distrotech-customers-trunk r336158 - /team/irroot/distr...

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


Author: irroot
Date: Thu Sep 15 14:29:07 2011
New Revision: 336158

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

Modified:
    team/irroot/distrotech-customers-trunk/res/res_fax.c

Modified: team/irroot/distrotech-customers-trunk/res/res_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-trunk/res/res_fax.c?view=diff&rev=336158&r1=336157&r2=336158
==============================================================================
--- team/irroot/distrotech-customers-trunk/res/res_fax.c (original)
+++ team/irroot/distrotech-customers-trunk/res/res_fax.c Thu Sep 15 14:29:07 2011
@@ -3102,7 +3102,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;
 	struct ast_format orig_read_format;
 	AST_LIST_HEAD_NOLOCK(, ast_frame) deferred_frames;
@@ -3120,13 +3120,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);
 
@@ -3169,7 +3169,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