kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit facc8b9d6c5d4547d5c496f988d4e3409e094c52
parent 543a329ef6802ea8a9538189ec8bdf6fb1ef5e01
Author: Joris Vink <joris@coders.se>
Date:   Mon, 26 Dec 2016 20:08:53 +0100

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

Diffstat:
src/connection.c | 4+++-
src/http.c | 3++-
2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/connection.c b/src/connection.c @@ -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); } diff --git a/src/http.c b/src/http.c @@ -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);