From ca4b9aca28f01ad4679d55f0167fce2b525f9107 Mon Sep 17 00:00:00 2001 From: Keith Rarick Date: Sun, 22 Feb 2009 20:26:47 -0800 Subject: [PATCH] Don't keep a pointer to a job that might be freed. --- prot.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/prot.c b/prot.c index 9c2c46c..cc20da0 100644 --- a/prot.c +++ b/prot.c @@ -1386,6 +1386,13 @@ h_conn_timeout(conn c) * whether or not the client is waiting for a new reservation. */ while ((j = soonest_job(c))) { if (j->deadline > time(NULL)) break; + + /* This job is in the middle of being written out. If we return it to + * the ready queue, someone might free it before we finish writing it + * out to the socket. So we'll copy it here and free the copy when it's + * done sending. */ + if (j == c->out_job) c->out_job = job_copy(c->out_job); + timeout_ct++; /* stats */ j->timeout_ct++; r = enqueue_job(remove_this_reserved_job(c, j), 0); -- 2.11.4.GIT