]> granicus.if.org Git - curl/commitdiff
Curl_llist_destroy() checks the input for non-NULL
authorDaniel Stenberg <daniel@haxx.se>
Thu, 14 Aug 2003 15:06:08 +0000 (15:06 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 14 Aug 2003 15:06:08 +0000 (15:06 +0000)
lib/llist.c

index 9e38f67666ce00b356b931a9434175618fe7c3e2..7ffdb10435392d3537832b5468c7e191169ef754 100644 (file)
@@ -159,10 +159,10 @@ Curl_llist_count(curl_llist *list)
 void 
 Curl_llist_destroy(curl_llist *list, void *user)
 {
-  while (list->size > 0) {
-    Curl_llist_remove(list, CURL_LLIST_TAIL(list), user);
-  }
+  if(list) {
+    while (list->size > 0)
+      Curl_llist_remove(list, CURL_LLIST_TAIL(list), user);
 
-  free(list);
-  list = NULL;
+    free(list);
+  }
 }