diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2012-08-31 14:34:59 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-08-31 14:34:59 +0200 |
commit | b964910868b53bcc2fea96b170255a1de6e7994d (patch) | |
tree | 6ba879848ea6e6a1e14d15f8aa1342a6301b5799 | |
parent | 197d9ef643b511fc230d6d190718adc338b64731 (diff) | |
download | rsyslog-b964910868b53bcc2fea96b170255a1de6e7994d.tar.gz rsyslog-b964910868b53bcc2fea96b170255a1de6e7994d.tar.bz2 rsyslog-b964910868b53bcc2fea96b170255a1de6e7994d.zip |
fix memory leak
-rw-r--r-- | runtime/msg.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/runtime/msg.c b/runtime/msg.c index 25b4ceeb..a89a01d2 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -2454,7 +2454,6 @@ msgGetCEEPropJSON(msg_t *pM, es_str_t *propName, struct json_object **pjson) uchar *name = NULL; uchar *leaf; struct json_object *parent; - struct json_object *field; DEFiRet; dbgprintf("AAAA: enter getCEEPropJSON\n"); @@ -3715,11 +3714,14 @@ jsonMerge(struct json_object *existing, struct json_object *json) json_object_object_foreachC(json, it) { dbgprintf("AAAA jsonMerge adds '%s'\n", it.key); - json_object_object_add(existing, it.key, it.val); + json_object_object_add(existing, it.key, + json_object_get(it.val)); } - /* TODO: we need to free what we no longer need. But that means I - * must be totally clear on the refcounting first ;) --> later + /* note: json-c does ref counting. We added all descandants refcounts + * in the loop above. So when we now free(_put) the root object, only + * root gets freed(). */ + json_object_put(json); RETiRet; } |