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)
212 case json_string: 212 case json_string:
213 grecs_free(obj->v.s); 213 grecs_free(obj->v.s);
214 break; 214 break;
215 case json_arr: 215 case json_arr:
216 for (i = 0; i < obj->v.a->oc; i++) 216 for (i = 0; i < obj->v.a->oc; i++)
217 json_value_free(obj->v.a->ov[i]); 217 json_value_free(obj->v.a->ov[i]);
218 grecs_free (obj->v.a->ov);
218 if (obj->v.a->ol) { 219 if (obj->v.a->ol) {
219 obj->v.a->ol->free_entry = objfree; 220 obj->v.a->ol->free_entry = objfree;
220 grecs_list_free(obj->v.a->ol); 221 grecs_list_free(obj->v.a->ol);
221 } 222 }
222 grecs_free(obj->v.a); 223 grecs_free(obj->v.a);
223 break; 224 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)
144 if (fmt->indent) { 144 if (fmt->indent) {
145 json_writec(fmt, '\n'); 145 json_writec(fmt, '\n');
146 json_indent(fmt, level-1); 146 json_indent(fmt, level-1);
147 } 147 }
148 } 148 }
149 json_writec(fmt, '}'); 149 json_writec(fmt, '}');
150 grecs_free(keypairs);
150} 151}
151 152
152static void 153static void
153json_format_array(struct json_format *fmt, struct json_value *obj, 154json_format_array(struct json_format *fmt, struct json_value *obj,
154 size_t level) 155 size_t level)
155{ 156{

Return to:

Send suggestions and report system problems to the System administrator.