Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http: fix ptr of conn and request at req_close #46

Merged
merged 2 commits into from
Dec 2, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/http/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ static void conn_idle(struct conn *conn)
return;

req = conn->req;
if (req)
if (!req)
return;
sreimers marked this conversation as resolved.
Show resolved Hide resolved

cli = req->cli;
if (cli)
if (!cli)
return;

tmr_start(&conn->tmr, cli->conf.idle_timeout, timeout_handler, conn);
Expand All @@ -181,10 +181,13 @@ static void req_close(struct http_req *req, int err,
if (req->connh)
req->connh(req->conn->tc, req->conn->sc, req->arg);

if (err || req->close || req->connh)
if (err || req->close || req->connh) {
mem_deref(req->conn);
else
}
else {
conn_idle(req->conn);
req->conn->req = NULL;
}

req->conn = NULL;
}
Expand Down