From: tedu Date: Thu, 15 Oct 2015 21:59:54 +0000 (+0000) Subject: do not insert entry into cache until it's fully formed X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=af74d894409e67e23a3764a26822dc300aef0546;p=openbsd do not insert entry into cache until it's fully formed --- diff --git a/usr.sbin/rebound/rebound.c b/usr.sbin/rebound/rebound.c index 724fc60303d..28ea943ecff 100644 --- a/usr.sbin/rebound/rebound.c +++ b/usr.sbin/rebound/rebound.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rebound.c,v 1.10 2015/10/15 21:56:52 tedu Exp $ */ +/* $OpenBSD: rebound.c,v 1.11 2015/10/15 21:59:54 tedu Exp $ */ /* * Copyright (c) 2015 Ted Unangst * @@ -218,12 +218,12 @@ sendreply(int ud, struct request *req) if (req->cacheent) { req->cacheent->ts = now; req->cacheent->ts.tv_sec += 10; - TAILQ_INSERT_TAIL(&cache, req->cacheent, cache); req->cacheent->resp = malloc(r); if (!req->cacheent->resp) return; memcpy(req->cacheent->resp, buf, r); req->cacheent->resplen = r; + TAILQ_INSERT_TAIL(&cache, req->cacheent, cache); } }