summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2012-09-03 18:44:17 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2012-09-04 10:17:16 +0200
commit080825632bd32e6baae1afde00df307fd4237ee4 (patch)
tree1358103d7ddaf4d8c10972b1fef025171f0e8202
parentb38fa5219f2f8ae3b6366ab911d9662f9340f70d (diff)
downloadrsyslog-080825632bd32e6baae1afde00df307fd4237ee4.tar.gz
rsyslog-080825632bd32e6baae1afde00df307fd4237ee4.tar.bz2
rsyslog-080825632bd32e6baae1afde00df307fd4237ee4.zip
Free a temporary object for the "name" property
Fixes a memory leak. Another option is to use cstrConstructFromESStr, but that would change semantics of NUL handling. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
-rw-r--r--template.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/template.c b/template.c
index 74a87c99..5d933619 100644
--- a/template.c
+++ b/template.c
@@ -1328,9 +1328,12 @@ createPropertyTpe(struct template *pTpl, struct cnfobj *o)
if(!pvals[i].bUsed)
continue;
if(!strcmp(pblkProperty.descr[i].name, "name")) {
- rsCStrConstructFromszStr(&name,
- (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL));
+ char *tmp;
+
+ tmp = es_str2cstr(pvals[i].val.d.estr, NULL);
+ rsCStrConstructFromszStr(&name, (uchar*)tmp);
cstrFinalize(name);
+ free(tmp);
} else if(!strcmp(pblkProperty.descr[i].name, "droplastlf")) {
droplastlf = pvals[i].val.d.n;
} else if(!strcmp(pblkProperty.descr[i].name, "mandatory")) {