Skip to content

Commit

Permalink
There's a memory leak in yajl 2.1.0 with use of yajl_tree_parse funct…
Browse files Browse the repository at this point in the history
…ion (#421)
  • Loading branch information
aekoroglu authored Oct 10, 2023
1 parent 2d527d9 commit e8965df
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/yajl/yajl_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ static yajl_val context_pop(context_t *ctx)

v = stack->value;

free (stack->key);
free (stack);

return (v);
Expand Down Expand Up @@ -455,7 +456,14 @@ 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 != NULL) {
yajl_val v = context_pop(&ctx);
yajl_tree_free(v);
}
yajl_free (handle);
//If the requested memory is not released in time, it will cause memory leakage
if(ctx.root)
yajl_tree_free(ctx.root);
return NULL;
}

Expand Down

0 comments on commit e8965df

Please sign in to comment.