set req->owner to NULL when the connection removes it.

This commit is contained in:
Joris Vink 2016-12-26 20:08:53 +01:00
parent 543a329ef6
commit facc8b9d6c
2 changed files with 5 additions and 2 deletions

View File

@ -333,9 +333,11 @@ kore_connection_remove(struct connection *c)
kore_free(c->hdlr_extra);
#if !defined(KORE_NO_HTTP)
for (req = TAILQ_FIRST(&(c->http_requests)); req != NULL; req = rnext) {
for (req = TAILQ_FIRST(&(c->http_requests));
req != NULL; req = rnext) {
rnext = TAILQ_NEXT(req, olist);
TAILQ_REMOVE(&(c->http_requests), req, olist);
req->owner = NULL;
req->flags |= HTTP_REQUEST_DELETE;
http_request_wakeup(req);
}

View File

@ -419,7 +419,8 @@ http_request_free(struct http_request *req)
req->path = NULL;
TAILQ_REMOVE(&http_requests, req, list);
TAILQ_REMOVE(&(req->owner->http_requests), req, olist);
if (req->owner != NULL)
TAILQ_REMOVE(&(req->owner->http_requests), req, olist);
for (hdr = TAILQ_FIRST(&(req->resp_headers)); hdr != NULL; hdr = next) {
next = TAILQ_NEXT(hdr, list);