From 4bf62f616b82fad7a7f91195b0204dd64d79a35c Mon Sep 17 00:00:00 2001
From: Simon Kelley <simon@thekelleys.org.uk>
Date: Thu, 10 Jan 2019 21:54:22 +0000
Subject: [PATCH 28/32] Tidy cache_blockdata_free()

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
---
 src/cache.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

--- a/src/cache.c
+++ b/src/cache.c
@@ -200,14 +200,17 @@ static void cache_hash(struct crec *crec
 
 static void cache_blockdata_free(struct crec *crecp)
 {
-  if (crecp->flags & F_SRV && !(crecp->flags & F_NEG))
-    blockdata_free(crecp->addr.srv.target);
+  if (!(crecp->flags & F_NEG))
+    {
+      if (crecp->flags & F_SRV)
+	blockdata_free(crecp->addr.srv.target);
 #ifdef HAVE_DNSSEC
-  else if (crecp->flags & F_DNSKEY)
-    blockdata_free(crecp->addr.key.keydata);
-  else if ((crecp->flags & F_DS) && !(crecp->flags & F_NEG))
-    blockdata_free(crecp->addr.ds.keydata);
+      else if (crecp->flags & F_DNSKEY)
+	blockdata_free(crecp->addr.key.keydata);
+      else if (crecp->flags & F_DS)
+	blockdata_free(crecp->addr.ds.keydata);
 #endif
+    }
 }
 
 static void cache_free(struct crec *crecp)
