[asterisk-commits] kharwell: branch 11 r432362 - in /branches/11: apps/app_chanspy.c main/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Feb 26 11:06:12 CST 2015


Author: kharwell
Date: Thu Feb 26 11:06:01 2015
New Revision: 432362

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=432362
Log:
app_chanspy, channel: fix frame leaks

Fixed a couple of frame leaks that were found during testing.

ASTERISK-24828 #close
Reported by: John Hardin
Review: https://reviewboard.asterisk.org/r/4445/

Modified:
    branches/11/apps/app_chanspy.c
    branches/11/main/channel.c

Modified: branches/11/apps/app_chanspy.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/apps/app_chanspy.c?view=diff&rev=432362&r1=432361&r2=432362
==============================================================================
--- branches/11/apps/app_chanspy.c (original)
+++ branches/11/apps/app_chanspy.c Thu Feb 26 11:06:01 2015
@@ -648,6 +648,9 @@
 	while (ast_waitfor(chan, -1) > -1 && csth.spy_audiohook.status == AST_AUDIOHOOK_STATUS_RUNNING) {
 		if (!(f = ast_read(chan)) || ast_check_hangup(chan)) {
 			running = -1;
+			if (f) {
+				ast_frfree(f);
+			}
 			break;
 		}
 

Modified: branches/11/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/main/channel.c?view=diff&rev=432362&r1=432361&r2=432362
==============================================================================
--- branches/11/main/channel.c (original)
+++ branches/11/main/channel.c Thu Feb 26 11:06:01 2015
@@ -3033,14 +3033,14 @@
 				}
 			}
 
-			if (res == 0) {
-				ast_channel_lock(chan);
-				while ((cur = AST_LIST_REMOVE_HEAD(&frames, frame_list))) {
+			ast_channel_lock(chan);
+			while ((cur = AST_LIST_REMOVE_HEAD(&frames, frame_list))) {
+				if (res == 0) {
 					ast_queue_frame_head(chan, cur);
-					ast_frfree(cur);
 				}
-				ast_channel_unlock(chan);
-			}
+				ast_frfree(cur);
+			}
+			ast_channel_unlock(chan);
 		} while (0);
 		break;
 	default:




More information about the asterisk-commits mailing list