Diskcache: Fix a minor Bug.

  * Under some conditions we can write outside the buffer. Oops.
io.c: Fix a ressource leak on error.
http_parse.c: fix a false memory leak.

  * just for the fun, but this should never occur.
  * add an assert for debug mode.

  + Non-author changes to origial patch:

  * Removed trailing whitespace.
event.c: Fix potential leak on error.

  * Try to restore pointers as they should be...
diskcache.c: Fix memory leak on error.

  * Reassign oldbuf to buff to free it on error.
diskcache.c: Fix a memory leak on failure.
config.c: Fix a memory leak on error [i].
config.c: Fix a memory leak on error [ii].
dns.c: Avoid a null dereference on error.
diskcache.c: check return value.
server.c: don't pass a negative value.
http_parse.c: if error, then return ...
io.c: By principle, don't use strcpy.

  * even if safe here, don't use it.
http.c: By principle, don't use strcpy.

  * even if safe here, don't use it.
diskcache.c: By principle, don't use strcpy.

  * even if safe here, don't use it.
  * use sizeof for static buffer size.
atom.c: By principle, don't use strcpy.

  * even if safe here, don't use it.
event.c: just to prevent warning.

  * under some systems sa_restorer is present.
  * set the struct to 0 so we don't care.
Client.c: Fix a recursive segfault.

  * httpClientNoticeRequest is called by httpServeObject with a
    novalidate set to 1.
  * But the reasons why we enter in this case (the loop case) are very
    obscure to me. The real fix is probably not here.
  * We were crashing the stack.
  * This looks like a very old problem and a reason of lots of
    complaining on the web...
  * Testing this case is rather simple on my computer:
    * Build a huge cache (~4000 url on the same host)
    * Use the lowest memory footprint possible (as per the sample config)
    * Set proxyOffline to true
    * Use http_proxy=127.0.0.1:8123 wget --input-file=list_url.txt
      --delete-after
    * Before the fix, 2 run max makes polipo enter the loop
    * After, it never crashes again (and a log is displayed)
    * Some other bug is triggered, but that's another story
Fix a segmentation fault that was reproducible with curl's test #9

The issue was previously reported by Ming Fu and David Röthlisberger.

Patch taken from here :-
http://article.gmane.org/gmane.comp.web.polipo.user/3013
Stop asserting that released objects have no condition handlers

The assertions were reproducible triggered by curl's test 9.

Patch taken from here :-
http://article.gmane.org/gmane.comp.web.polipo.user/3013