[Asterisk-code-review] frame.c: Make ast frame free()/ast frfree() NULL tolerant (asterisk[15])

Richard Mudgett asteriskteam at digium.com
Sat Nov 11 13:04:41 CST 2017


Richard Mudgett has uploaded this change for review. ( https://gerrit.asterisk.org/7193


Change subject: frame.c: Make ast_frame_free()/ast_frfree() NULL tolerant
......................................................................

frame.c: Make ast_frame_free()/ast_frfree() NULL tolerant

Change-Id: Ic49d821ef88ada38a31bdd835b9531443c55d793
---
M main/frame.c
1 file changed, 4 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/93/7193/1

diff --git a/main/frame.c b/main/frame.c
index c24cc8f..8a151ef 100644
--- a/main/frame.c
+++ b/main/frame.c
@@ -163,18 +163,16 @@
 {
 	struct ast_frame *next;
 
-	for (next = AST_LIST_NEXT(frame, frame_list);
-	     frame;
-	     frame = next, next = frame ? AST_LIST_NEXT(frame, frame_list) : NULL) {
+	while (frame) {
+		next = AST_LIST_NEXT(frame, frame_list);
 		__frame_free(frame, cache);
+		frame = next;
 	}
 }
 
 void ast_frame_dtor(struct ast_frame *f)
 {
-	if (f) {
-		ast_frfree(f);
-	}
+	ast_frfree(f);
 }
 
 /*!

-- 
To view, visit https://gerrit.asterisk.org/7193
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic49d821ef88ada38a31bdd835b9531443c55d793
Gerrit-Change-Number: 7193
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171111/dd5d9dd1/attachment.html>


More information about the asterisk-code-review mailing list