summaryrefslogtreecommitdiffstats
path: root/runtime/dnscache.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2013-01-22 14:52:34 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2013-01-22 14:52:34 +0100
commit45d11af0b9975937e536d1c9b6d7bdaff5ade1b0 (patch)
tree7416e7c657244acfbda92e1a1507f78d7bef74ff /runtime/dnscache.c
parent440aaff114607e82aefee56336846611a2e35c9c (diff)
downloadrsyslog-45d11af0b9975937e536d1c9b6d7bdaff5ade1b0.tar.gz
rsyslog-45d11af0b9975937e536d1c9b6d7bdaff5ade1b0.tar.bz2
rsyslog-45d11af0b9975937e536d1c9b6d7bdaff5ade1b0.zip
some fixes to commit 440aaff114607e82aefee56336846611a2e35c9c
extended testbench run brought up some issues...
Diffstat (limited to 'runtime/dnscache.c')
-rw-r--r--runtime/dnscache.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/runtime/dnscache.c b/runtime/dnscache.c
index 7e9ebf5b..ef168f23 100644
--- a/runtime/dnscache.c
+++ b/runtime/dnscache.c
@@ -69,7 +69,7 @@ DEFobjCurrIf(glbl)
DEFobjCurrIf(errmsg)
DEFobjCurrIf(prop)
static dnscache_t dnsCache;
-static prop_t *staticErrIPValue;
+static prop_t *staticErrValue;
/* Our hash function.
@@ -128,9 +128,9 @@ dnscacheInit(void)
CHKiRet(objUse(errmsg, CORE_COMPONENT));
CHKiRet(objUse(prop, CORE_COMPONENT));
- prop.Construct(&staticErrIPValue);
- prop.SetString(staticErrIPValue, (uchar*)"???", 3);
- prop.ConstructFinalize(staticErrIPValue);
+ prop.Construct(&staticErrValue);
+ prop.SetString(staticErrValue, (uchar*)"???", 3);
+ prop.ConstructFinalize(staticErrValue);
finalize_it:
RETiRet;
}
@@ -140,7 +140,7 @@ rsRetVal
dnscacheDeinit(void)
{
DEFiRet;
- prop.Destruct(&staticErrIPValue);
+ prop.Destruct(&staticErrValue);
hashtable_destroy(dnsCache.ht, 1); /* 1 => free all values automatically */
pthread_rwlock_destroy(&dnsCache.rwlock);
objRelease(glbl, CORE_COMPONENT);
@@ -355,6 +355,7 @@ dnscacheLookup(struct sockaddr_storage *addr, prop_t **fqdn, prop_t **fqdnLowerC
} else {
CHKiRet(validateEntry(etry, addr));
}
+ prop.AddRef(etry->ip);
*ip = etry->ip;
if(fqdn != NULL) {
prop.AddRef(etry->fqdn);
@@ -369,15 +370,15 @@ finalize_it:
pthread_rwlock_unlock(&dnsCache.rwlock);
if(iRet != RS_RET_OK && iRet != RS_RET_ADDRESS_UNKNOWN) {
DBGPRINTF("dnscacheLookup failed with iRet %d\n", iRet);
- prop.AddRef(staticErrIPValue);
- *ip = staticErrIPValue;
+ prop.AddRef(staticErrValue);
+ *ip = staticErrValue;
if(fqdn != NULL) {
- prop.AddRef(staticErrIPValue);
- *fqdn = staticErrIPValue;
+ prop.AddRef(staticErrValue);
+ *fqdn = staticErrValue;
}
if(fqdnLowerCase != NULL) {
- prop.AddRef(staticErrIPValue);
- *fqdnLowerCase = staticErrIPValue;
+ prop.AddRef(staticErrValue);
+ *fqdnLowerCase = staticErrValue;
}
}
RETiRet;