diff --git a/tests/test.c b/tests/test.c index 41e80a9..04fb767 100644 --- a/tests/test.c +++ b/tests/test.c @@ -125,7 +125,8 @@ static void testPaging(void) } printf("%d pages allocated\n", allocCount); - while ((page = list_pop_head(allocated_page_list)) != NULL) { + while (!list_is_empty(allocated_page_list) && + (page = list_pop_head(allocated_page_list)) != NULL) { assertmsg((char)page->phy_addr == (char)freeCount, "page modified %d but is %d\n", freeCount, page->phy_addr); assertmsg(unrefPhyPage((ulong)page) >= 0, "Failed to free page %d\n", (ulong)page); @@ -326,7 +327,7 @@ void run_test(void) char *strAlloc; int ret = asprintf(&strAlloc, "hello %s\n", "world"); printf("asprint ret %d %s\n", ret, strAlloc); - assert(ret == 13); //include the '\0' + assert(ret == 13); // include the '\0' free(strAlloc); } testPaging();