From 0334a23918ebb008f81694e855141b8d8f5f72a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Neira=20Ayuso?= Date: Wed, 14 Aug 2013 12:19:19 +0200 Subject: json: fixed some leaks in the json parsing function This patch fixes some leaks in the json parsing function. After this patch, we use nft_jansson_free_root. This function uses json_decref and it decrements the reference count and it releases the node if needed. Signed-off-by: Alvaro Neira Ayuso Signed-off-by: Pablo Neira Ayuso --- src/internal.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/internal.h') diff --git a/src/internal.h b/src/internal.h index 62eb3c5..5ca2288 100644 --- a/src/internal.h +++ b/src/internal.h @@ -48,7 +48,9 @@ int nft_jansson_value_parse_val(json_t *root, const char *tag, int type, void *out); const char *nft_jansson_value_parse_str(json_t *root, const char *tag); bool nft_jansson_node_exist(json_t *root, const char *tag); -json_t *nft_jansson_get_root(char *json, const char *tag, json_error_t *err); +json_t *nft_jansson_create_root(char *json, json_error_t *err); +json_t *nft_jansson_get_node(json_t *root, const char *tag); +void nft_jansson_free_root(json_t *root); int nft_jansson_parse_family(json_t *root, void *out); #endif -- cgit v1.2.3