From: Vincent Bernat Date: Thu, 19 May 2016 18:37:59 +0000 (+0200) Subject: client: remove memory leak introduced in JSON writers X-Git-Tag: 0.9.3~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=83297e97be8e34e4f92f748f967f8acf6fb2ea1c;p=thirdparty%2Flldpd.git client: remove memory leak introduced in JSON writers --- diff --git a/src/client/jansson_writer.c b/src/client/jansson_writer.c index c14ad8c4..0fb179d9 100644 --- a/src/client/jansson_writer.c +++ b/src/client/jansson_writer.c @@ -188,6 +188,7 @@ jansson_finish(struct writer *w) /* memory will leak... */ } else { struct json_element *root = TAILQ_FIRST(&p->els); + json_decref(root->el); TAILQ_REMOVE(&p->els, root, next); free(root); } diff --git a/src/client/jsonc_writer.c b/src/client/jsonc_writer.c index 90a2513b..332712e7 100644 --- a/src/client/jsonc_writer.c +++ b/src/client/jsonc_writer.c @@ -182,6 +182,7 @@ jsonc_finish(struct writer *w) /* memory will leak... */ } else { struct json_element *root = TAILQ_FIRST(&p->els); + json_object_put(root->el); TAILQ_REMOVE(&p->els, root, next); free(root); }