From 85ff9aece8868920d49300b099da091980c45553 Mon Sep 17 00:00:00 2001 From: Bryan Roe Date: Tue, 26 Jan 2021 17:42:34 -0800 Subject: [PATCH] Fixed potential infinite loop --- microstack/ILibParsers.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/microstack/ILibParsers.c b/microstack/ILibParsers.c index 2fb1cb5..e27c639 100644 --- a/microstack/ILibParsers.c +++ b/microstack/ILibParsers.c @@ -8246,7 +8246,10 @@ void ILibLinkedList_Destroy(void *LinkedList) if (ILibMemory_CanaryOK(LinkedList)) { struct ILibLinkedListNode_Root *r = (struct ILibLinkedListNode_Root*)LinkedList; - while (r->Head != NULL) ILibLinkedList_Remove(ILibLinkedList_GetNode_Head(LinkedList)); + while (r->Head != NULL && ILibLinkedList_GetNode_Head(LinkedList) != NULL) + { + ILibLinkedList_Remove(ILibLinkedList_GetNode_Head(LinkedList)); + } ILibMemory_Free(r); } }