Skip to content

Commit

Permalink
Fix: Check malloc.
Browse files Browse the repository at this point in the history
  • Loading branch information
ishkhan42 committed Apr 14, 2023
1 parent e61fcb4 commit 3ee198d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/python.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ static void wrapper(ujrpc_call_t call, ujrpc_callback_tag_t callback_tag) {

size_t sz = calculate_size_as_str(response);
char* parsed_response = (char*)(malloc(sz * sizeof(char)));
if (!parsed_response)
return ujrpc_call_reply_error_out_of_memory(call);
size_t len = 0;
int res = to_string(response, &parsed_response[0], &len);
ujrpc_call_reply_content(call, &parsed_response[0], len);
Expand Down

0 comments on commit 3ee198d

Please sign in to comment.