Question: For a program that I am working on, I have a doubly linked list. I now have to figure out a particular node where a particular data (called `id`) becomes negative, and then dereference the following nodes and also free the memory. When I call this function (pasted below), the last print statement is executed and prints on screen. However the program doesn't return to main. It simply hangs. (Right after this function call, I have another print statement which doesn't get executed and the program hangs there endlessly). 

```
static void clear_ghosts(particles *plist)
{
  particles * temp = plist;

  while(temp!=NULL) {
      if(temp->p->id < 0)
      {
          break;
      }
  temp = temp->next;

 }

 if(temp)
 {
     particles * current = temp;
     particles * next;
     while(current !=NULL)
     {
         next = current->next;
         free(current);
         current = next;
     }
     temp = NULL;
 }

 printf("\n Finished Clearing \n");
 return;

}

```

Here `plist` is a linked list of type `struct particle *`. `plist` has data `p` which itself is a struct and has member data like `id` etc. I need to loop through the list and terminate the list when the member id that is negative is encountered. I am getting the output "Finished Clearing", but the function is not returning to main. 

What could be going wrong?

Answer: 
The [W3C link checker](http://validator.w3.org/checklink) will give you a list of all the links and tell you which ones are working. It should be pretty trivial to scrap the output to show only external links.
Eventually, the easiest way was with an SQL Query in the database, so make sure you check if it is do able when you have a similar problem, via SQL before trying to find external programs.

Thanks to everyone for suggestions.