aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2016-02-21 16:28:34 +0200
committerSergey Poznyakoff <gray@gnu.org>2016-02-21 16:28:34 +0200
commit07838fb2e9ed5769074add028e052a3b667e67e7 (patch)
tree671a34f3a25abece344e27eb0d5fc4c0ed33e4b1 /src
parenta3f25ce24dcaff123fb71db89419d3ae12ddb57a (diff)
downloadgrecs-07838fb2e9ed5769074add028e052a3b667e67e7.tar.gz
grecs-07838fb2e9ed5769074add028e052a3b667e67e7.tar.bz2
Fix memory leaks
Diffstat (limited to 'src')
-rw-r--r--src/json-gram.y1
-rw-r--r--src/jsonfmt.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/src/json-gram.y b/src/json-gram.y
index ab65362..ca50097 100644
--- a/src/json-gram.y
+++ b/src/json-gram.y
@@ -212,12 +212,13 @@ json_value_free(struct json_value *obj)
case json_string:
grecs_free(obj->v.s);
break;
case json_arr:
for (i = 0; i < obj->v.a->oc; i++)
json_value_free(obj->v.a->ov[i]);
+ grecs_free (obj->v.a->ov);
if (obj->v.a->ol) {
obj->v.a->ol->free_entry = objfree;
grecs_list_free(obj->v.a->ol);
}
grecs_free(obj->v.a);
break;
diff --git a/src/jsonfmt.c b/src/jsonfmt.c
index 0687faf..0f44536 100644
--- a/src/jsonfmt.c
+++ b/src/jsonfmt.c
@@ -144,12 +144,13 @@ json_format_obj(struct json_format *fmt, struct json_value *obj, size_t level)
if (fmt->indent) {
json_writec(fmt, '\n');
json_indent(fmt, level-1);
}
}
json_writec(fmt, '}');
+ grecs_free(keypairs);
}
static void
json_format_array(struct json_format *fmt, struct json_value *obj,
size_t level)
{

Return to:

Send suggestions and report system problems to the System administrator.