[asterisk-commits] irroot: branch irroot/distrotech-customers-1.8 r336160 - /team/irroot/distrot...

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


Author: irroot
Date: Thu Sep 15 14:31:24 2011
New Revision: 336160

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

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

Modified: team/irroot/distrotech-customers-1.8/res/res_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-1.8/res/res_fax.c?view=diff&rev=336160&r1=336159&r2=336160
==============================================================================
--- team/irroot/distrotech-customers-1.8/res/res_fax.c (original)
+++ team/irroot/distrotech-customers-1.8/res/res_fax.c Thu Sep 15 14:31:24 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