You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code in brk_shot_reuse() doesn't check the return value and directly assigns it to the pointer variable being extended. This is bad for two reasons:
the old value of the pointer gets overwritten, making it impossible to free the memory again (= memleak)
the following code will just crash
Since the rest of the code handles malloc() failures, I assume this is an oversight.
The text was updated successfully, but these errors were encountered:
marcmutz
added a commit
to marcmutz/libthai
that referenced
this issue
Jan 26, 2023
Handle failure of realloc() in brk_shot_reuse(), which requires adding
a return value to brk_shot_reuse() and handling it in
brk_pool_new_node().
If brk_shot_reuse() fails, try allocating a new node. Yes, if
realloc() failed, a following malloc() will likely fail, too, but this
way the error at least propagates up the call chain.
To keep the logic clean, factor the old if (env->free_list) code into
a separate function brk_pool_node_new_from_free_list().
Fixestlwg#23.
The code in brk_shot_reuse() doesn't check the return value and directly assigns it to the pointer variable being extended. This is bad for two reasons:
Since the rest of the code handles malloc() failures, I assume this is an oversight.
The text was updated successfully, but these errors were encountered: