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 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.