Skip to content

Commit

Permalink
yajl: fix memory leak problem
Browse files Browse the repository at this point in the history
reason: fix memory leak problem
(cherry picked from commit 3d65cb0
 in https://github.com/openEuler-BaseService)

Fixes: lloyd#250  (CVE-2023-33460)
  • Loading branch information
JingWoo authored and berrange committed Jul 10, 2023
1 parent 32f1b51 commit 2a156cf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/yajl_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ static yajl_val context_pop(context_t *ctx)
ctx->stack = stack->next;

v = stack->value;

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

return (v);
Expand Down Expand Up @@ -444,6 +444,10 @@ 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);
return NULL;
}
Expand Down

0 comments on commit 2a156cf

Please sign in to comment.