From: Richard Mudgett Date: Sat, 11 Nov 2017 15:42:01 +0000 (-0600) Subject: frame.c: Make ast_frame_free()/ast_frfree() NULL tolerant X-Git-Tag: 13.19.0-rc1~136 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb2173275a114b4b1cbdb23ff5884cab822ac7f1;p=thirdparty%2Fasterisk.git frame.c: Make ast_frame_free()/ast_frfree() NULL tolerant Change-Id: Ic49d821ef88ada38a31bdd835b9531443c55d793 --- diff --git a/main/frame.c b/main/frame.c index 4261b04dd2..9fd1f78893 100644 --- a/main/frame.c +++ b/main/frame.c @@ -165,18 +165,16 @@ void ast_frame_free(struct ast_frame *frame, int cache) { 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); } /*!