From af74d894409e67e23a3764a26822dc300aef0546 Mon Sep 17 00:00:00 2001 From: tedu Date: Thu, 15 Oct 2015 21:59:54 +0000 Subject: [PATCH] do not insert entry into cache until it's fully formed --- usr.sbin/rebound/rebound.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); } } -- 2.20.1