Skip to content

Commit a43eb11

Browse files
committed
Fix ListDestroy
1 parent 947dde9 commit a43eb11

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/list.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -282,16 +282,16 @@ LIBNEX_PUBLIC void ListDestroyEntry (ListHead_t* list, ListEntry_t* entry)
282282
LIBNEX_PUBLIC void ListDestroy (ListHead_t* list)
283283
{
284284
ListLock (list);
285-
// Go through every entry, destroying it
286-
ListEntry_t* curEntry = list->front;
287-
while (curEntry)
288-
{
289-
ListEntry_t* next = curEntry->next;
290-
ListDestroyEntry (list, curEntry);
291-
curEntry = next;
292-
}
293285
if (!ListDeRef (list))
294286
{
287+
// Go through every entry, destroying it
288+
ListEntry_t* curEntry = list->front;
289+
while (curEntry)
290+
{
291+
ListEntry_t* next = curEntry->next;
292+
ListDestroyEntry (list, curEntry);
293+
curEntry = next;
294+
}
295295
ListUnlock (list);
296296
free (list);
297297
}

0 commit comments

Comments
 (0)