summaryrefslogtreecommitdiffstats
path: root/tcps_sess.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-04-24 10:54:51 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-04-24 10:54:51 +0200
commit0e19d501bbf4d96bc622436a161b57ff7445a657 (patch)
treee27819242c00bf3b5f15226203d4b696cc4cb61d /tcps_sess.c
parentbf3d2c1b392af1383a3cdc247f2280fd31a12699 (diff)
downloadrsyslog-0e19d501bbf4d96bc622436a161b57ff7445a657.tar.gz
rsyslog-0e19d501bbf4d96bc622436a161b57ff7445a657.tar.xz
rsyslog-0e19d501bbf4d96bc622436a161b57ff7445a657.zip
fixed newly introduced memory leaks
Diffstat (limited to 'tcps_sess.c')
-rw-r--r--tcps_sess.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/tcps_sess.c b/tcps_sess.c
index 27bdbf89..33c13aa0 100644
--- a/tcps_sess.c
+++ b/tcps_sess.c
@@ -100,6 +100,10 @@ ENDobjDebugPrint(tcps_sess)
/* set property functions */
+/* set the hostname. Note that the caller *hands over* the string. That is,
+ * the caller no longer controls it once SetHost() has received it. Most importantly,
+ * the caller must not free it. -- gerhards, 2008-04-24
+ */
static rsRetVal
SetHost(tcps_sess_t *pThis, uchar *pszHost)
{
@@ -109,11 +113,9 @@ SetHost(tcps_sess_t *pThis, uchar *pszHost)
if(pThis->fromHost != NULL) {
free(pThis->fromHost);
- pThis->fromHost = NULL;
}
- if((pThis->fromHost = strdup((char*)pszHost)) == NULL)
- ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY);
+ pThis->fromHost = pszHost;
finalize_it:
RETiRet;