Hi all,


(first post)



On tracking down a segfault I am getting in evhttp_clear_headers() (caused by my
code) I noticed that it doesn't validate its parameter or attempt to keep going
if passed null (see 2.0.19-stable code below). I am wondering if this is a
deliberate coding style for libevent. I.e., on seeing something like this,
should I be working around it in my own code or submitting a patch to http.c?



The functions forming the http API to application code seem generally to be
trusting of their parameters in this same way. Would contributions of more
assertions and defensive coding be welcome?



Thanks very much for your advice.



Best,

Andrew Cox



void
evhttp_clear_headers(struct evkeyvalq *headers)
{
   struct evkeyval *header;



   // [AHC} headers may be null, *headers may not be initialised



   for (header = TAILQ_FIRST(headers);
      header != NULL;
      header = TAILQ_FIRST(headers)) {
      TAILQ_REMOVE(headers, header, next);
      mm_free(header->key);
      mm_free(header->value);
      mm_free(header);
   }
}
***********************************************************************
To unsubscribe, send an e-mail to majord...@freehaven.net with
unsubscribe libevent-users    in the body.

Reply via email to