summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2012-09-03 19:39:43 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2012-09-04 10:21:03 +0200
commitddea340e665a657bc6be88176130d1221c0dec3d (patch)
treed26add6781c9cb6c8ffe9581259a720214d1dd20
parent18ff8d54dde1d0c8603d5f06800ce3d55eb86fb2 (diff)
downloadrsyslog-ddea340e665a657bc6be88176130d1221c0dec3d.tar.gz
rsyslog-ddea340e665a657bc6be88176130d1221c0dec3d.tar.bz2
rsyslog-ddea340e665a657bc6be88176130d1221c0dec3d.zip
Fix reference counting
When adding a JSON object to the template output, make sure to increment its reference count. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
-rw-r--r--template.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/template.c b/template.c
index 7940ab24..3cef586c 100644
--- a/template.c
+++ b/template.c
@@ -303,7 +303,7 @@ rsRetVal tplToJSON(struct template *pTpl, msg_t *pMsg, struct json_object **pjso
if(pTpe->data.field.propid == PROP_CEE) {
localRet = msgGetCEEPropJSON(pMsg, pTpe->data.field.propName, &jsonf);
if(localRet == RS_RET_OK) {
- json_object_object_add(json, (char*)pTpe->fieldName, jsonf);
+ json_object_object_add(json, (char*)pTpe->fieldName, json_object_get(jsonf));
} else {
DBGPRINTF("tplToJSON: error %d looking up property\n",
localRet);