mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-06 10:25:41 +02:00
Don't leak whatever is left of one parse tree when starting another
This commit is contained in:
@@ -180,6 +180,10 @@ static json_object *add_object(json_pull *j, json_type type) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (j->root != NULL) {
|
||||||
|
json_free(j->root);
|
||||||
|
}
|
||||||
|
|
||||||
j->root = o;
|
j->root = o;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,6 +276,10 @@ json_object *json_read_separators(json_pull *j, json_separator_callback cb, void
|
|||||||
|
|
||||||
// In case there is an error at the top level
|
// In case there is an error at the top level
|
||||||
if (j->container == NULL) {
|
if (j->container == NULL) {
|
||||||
|
if (j->root != NULL) {
|
||||||
|
json_free(j->root);
|
||||||
|
}
|
||||||
|
|
||||||
j->root = NULL;
|
j->root = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user