aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/services/dnsmasq/patches/0028-Tidy-cache_blockdata_free.patch
blob: ed8170c59b7aa0af9e15f96a8cc2c5262a9a655f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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/30] 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)