Skip to content

Commit

Permalink
yajl_tree_parse: fix memory leak on error
Browse files Browse the repository at this point in the history
ctx.stack was not being cleaned up after a parse error. this patch pops
all remaining elements and frees them.
  • Loading branch information
hstern committed Sep 3, 2015
1 parent 46d55e3 commit d74c806
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/yajl_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,9 @@ yajl_val yajl_tree_parse (const char *input,
snprintf(error_buffer, error_buffer_size, "%s", internal_err_str);
YA_FREE(&(handle->alloc), internal_err_str);
}
while (ctx.stack) {
yajl_tree_free(context_pop(&ctx));
}
yajl_free (handle);
return NULL;
}
Expand Down

0 comments on commit d74c806

Please sign in to comment.