diff --git a/src/connection.c b/src/connection.c index a58a173..4bf5e03 100644 --- 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 index fc02581..e772af9 100644 --- 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);