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

Joshua Colp asteriskteam at digium.com
Mon Nov 13 06:24:10 CST 2017


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/7194 )

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(-)

Approvals:
  Corey Farrell: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Approved for Submit



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/7194
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic49d821ef88ada38a31bdd835b9531443c55d793
Gerrit-Change-Number: 7194
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171113/0e166ae8/attachment.html>


More information about the asterisk-code-review mailing list