aboutsummaryrefslogtreecommitdiff
path: root/net/openmdns/files/patch-mdnsd_mdns.c
blob: a01c1ab456cda8d1328d489908e6a2108409d89a (plain) (blame)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
--- mdnsd/mdns.c.orig	2017-03-10 09:24:12 UTC
+++ mdnsd/mdns.c
@@ -45,6 +45,9 @@ extern struct mdnsd_conf	*conf;
 struct question_tree		 question_tree;
 struct cache_tree		 cache_tree;
 
+pg_q pg_queue;
+pge_q pge_queue;
+
 /*
  * RR cache
  */
@@ -155,8 +158,10 @@ cache_process(struct rr *rr)
 					/* TODO Cancel possible deletion */
 					log_warnx("cache_process: recover %s",
 					    rrs_str(&rr->rrs));
+					free(rr);
 					return (0);
 				}
+				free(rr);
 				return (0);
 			}
 			/*
@@ -167,6 +172,7 @@ cache_process(struct rr *rr)
 				log_warnx("cache_process: conflict for %s",
 				    rrs_str(&rr->rrs));
 				conflict_resolve_by_rr(rr_aux);
+				free(rr);
 				return (-1);
 			}
 		}
@@ -178,6 +184,7 @@ cache_process(struct rr *rr)
 					log_warnx("cache_process: goodbye %s",
 					    rrs_str(&rr->rrs));
 					cache_delete(rr_aux);
+					free(rr);
 					return (0);
 				}
 				/* Cache refresh */
@@ -186,14 +193,17 @@ cache_process(struct rr *rr)
 				rr_aux->ttl = rr->ttl;
 				rr_aux->revision = 0;
 				cache_schedrev(rr_aux);
+				free(rr);
 
 				return (0);
 			}
 		}
 	}
 	/* Got a goodbye for a record we don't have */
-	if (rr->ttl == 0)
+	if (rr->ttl == 0) {
+		free(rr);
 		return (0);
+	}
 
 	return (cache_insert(rr));
 }