diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2013-01-24 06:19:13 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-01-24 06:19:13 +0100 |
commit | 0d71694fb3cbff71d504769e0e70a58ebe5f9a0d (patch) | |
tree | d36030df25a095ac84a196a466f12456b3f855cb /tcps_sess.c | |
parent | 6b4d9afccb4297face53fd6bec0fb30b6a8da1c3 (diff) | |
download | rsyslog-0d71694fb3cbff71d504769e0e70a58ebe5f9a0d.tar.gz rsyslog-0d71694fb3cbff71d504769e0e70a58ebe5f9a0d.tar.bz2 rsyslog-0d71694fb3cbff71d504769e0e70a58ebe5f9a0d.zip |
optimize: have dns cache pre-create rsyslog prop_t's
Diffstat (limited to 'tcps_sess.c')
-rw-r--r-- | tcps_sess.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/tcps_sess.c b/tcps_sess.c index 523f2b9e..5821e443 100644 --- a/tcps_sess.c +++ b/tcps_sess.c @@ -140,24 +140,20 @@ finalize_it: RETiRet; } -/* set the remote host's IP. Note that the caller *hands over* the string. That is, +/* set the remote host's IP. Note that the caller *hands over* the property. That is, * the caller no longer controls it once SetHostIP() has received it. Most importantly, - * the caller must not free it. -- rgerhards, 2008-05-16 + * the caller must not destruct it. -- rgerhards, 2008-05-16 */ static rsRetVal -SetHostIP(tcps_sess_t *pThis, uchar *pszHostIP) +SetHostIP(tcps_sess_t *pThis, prop_t *ip) { DEFiRet; - ISOBJ_TYPE_assert(pThis, tcps_sess); - if(pThis->fromHostIP == NULL) - CHKiRet(prop.Construct(&pThis->fromHostIP)); - - CHKiRet(prop.SetString(pThis->fromHostIP, pszHostIP, ustrlen(pszHostIP))); - -finalize_it: - free(pszHostIP); + if(pThis->fromHostIP != NULL) { + prop.Destruct(&pThis->fromHostIP); + } + pThis->fromHostIP = ip; RETiRet; } |