summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2019-01-15 00:06:26 +0100
committerDaniel Stenberg <daniel@haxx.se>2019-01-15 00:06:41 +0100
commitd93dfbf88fc2e512e01b0342910c4c250e6bb1a4 (patch)
treec2d336a91e3faca7e5af64f6c1ebd4f860c7f4c0
parentc54ee668dfec73885ca801dcc835d0bb569c46e9 (diff)
downloadcurl-bagder/extract_if_dead-fwup.tar.gz
extract_if_dead: follow-up to 54b201b48c90abagder/extract_if_dead-fwup
extract_if_dead() dead is called from two functions, and only one of them should get conn->data updated and now neither clear it. scan-build found a case where conn->data would be NULL dereferenced in ConnectionExists() otherwise.
-rw-r--r--lib/url.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/url.c b/lib/url.c
index 273c11de5..bb53f2740 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -965,9 +965,7 @@ static bool extract_if_dead(struct connectdata *conn,
/* The protocol has a special method for checking the state of the
connection. Use it to check if the connection is dead. */
unsigned int state;
- conn->data = data; /* temporary transfer for this connection to use */
state = conn->handler->connection_check(conn, CONNCHECK_ISDEAD);
- conn->data = NULL; /* clear transfer again */
dead = (state & CONNRESULT_DEAD);
}
else {
@@ -996,6 +994,7 @@ struct prunedead {
static int call_extract_if_dead(struct connectdata *conn, void *param)
{
struct prunedead *p = (struct prunedead *)param;
+ conn->data = p->data; /* transfer to use for this check */
if(extract_if_dead(conn, p->data)) {
/* stop the iteration here, pass back the connection that was extracted */
p->extracted = conn;