From 91b7c55972122f6388a13edfc38967d154b9ceef Mon Sep 17 00:00:00 2001
From: Robert James Kaes <rjkaes@users.sourceforge.net>
Date: Tue, 26 Sep 2000 04:59:48 +0000
Subject: Fixed the insert function to handle a failed insert properly.

---
 src/dnscache.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/dnscache.c b/src/dnscache.c
index 7604c55..f8bb4a3 100644
--- a/src/dnscache.c
+++ b/src/dnscache.c
@@ -1,4 +1,4 @@
-/* $Id: dnscache.c,v 1.5 2000-09-11 23:42:43 rjkaes Exp $
+/* $Id: dnscache.c,v 1.6 2000-09-26 04:59:48 rjkaes Exp $
  *
  * This is a caching DNS system. When a host name is needed we look it up here
  * and see if there is already an answer for it. The domains are placed in a
@@ -74,7 +74,8 @@ static int dns_insert(struct in_addr *addr, char *domain)
 	newptr->ipaddr = *addr;
 	newptr->expire = time(NULL);
 
-	ternary_insert(dns_tree, domain, newptr);
+	if (TE_ISERROR(ternary_insert(dns_tree, domain, newptr)))
+		safefree(newptr);
 
 	return 0;
 }
-- 
cgit v1.2.3