diff options
author | Robert James Kaes <rjkaes@users.sourceforge.net> | 2000-09-26 04:59:48 +0000 |
---|---|---|
committer | Robert James Kaes <rjkaes@users.sourceforge.net> | 2000-09-26 04:59:48 +0000 |
commit | 91b7c55972122f6388a13edfc38967d154b9ceef (patch) | |
tree | 905b616c6a9cd11c8f9d47d4f5ab64ef0f2efe0f | |
parent | ba5e5fc10971719fa5f7584a113b1b26f5932f45 (diff) | |
download | tinyproxy-91b7c55972122f6388a13edfc38967d154b9ceef.tar.gz tinyproxy-91b7c55972122f6388a13edfc38967d154b9ceef.zip |
Fixed the insert function to handle a failed insert properly.
-rw-r--r-- | src/dnscache.c | 5 |
1 files 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; } |