cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker Archives

[ curl-Bugs-3583103 ] sometimes cycle forever in function Curl_llist_destroy

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Sun, 04 Nov 2012 00:29:26 -0700

Bugs item #3583103, was opened at 2012-11-04 00:23
Message generated for change (Comment added) made by phpor
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=3583103&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: libcurl
Group: hang
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: 李 俊杰 (phpor)
Assigned to: Daniel Stenberg (bagder)
Summary: sometimes cycle forever in function Curl_llist_destroy

Initial Comment:
In this function , the "while" block will cyle forever when list->size > 0 and list->tail == null
========================================= in lib/llist.c
void
Curl_llist_destroy(struct curl_llist *list, void *user)
{
  if(list) {
    while(list->size > 0) // if list->size > 0 and list->tail == null then it will cycle forever
      Curl_llist_remove(list, list->tail, user);

    free(list);
  }
}
======================================

version: all
OS: all

----------------------------------------------------------------------

>Comment By: 李 俊杰 (phpor)
Date: 2012-11-04 00:29

Message:
in function Curl_llist_remove(...) , the entry condition is (e != NULL &&
list->size > 0) ,then condition is not consistent with the condition of
"while" in Curl_llist_destroy

=====================
Curl_llist_remove(struct curl_llist *list, struct curl_llist_element *e,
                  void *user)
{
  if(e == NULL || list->size == 0)
    return 1;

  if(e == list->head) {
    list->head = e->next;

    if(list->head == NULL)
      list->tail = NULL;
    else
      e->next->prev = NULL;
  }
  else {
    e->prev->next = e->next;
    if(!e->next)
      list->tail = e->prev;
    else
      e->next->prev = e->prev;
  }

  list->dtor(user, e->ptr);

  e->ptr = NULL;
  e->prev = NULL;
  e->next = NULL;

  free(e);
  --list->size;

  return 1;
}
==============================

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=3583103&group_id=976
Received on 2012-11-04

These mail archives are generated by hypermail.

donate! Page updated January 05, 2012.
web site info

File upload with ASP.NET