Fix file leak on error path#121
Conversation
Close file when mpack_tree_init_stdfile() fails after checking its size Signed-off-by: Jesús Fernández Manzano <jesus.fernandez@titanos.tv>
|
Thanks. This fix is fine. The documentation for this function states that the file is closed (if requested) before the function is returned regardless of errors, so yes, we should close the file here. It's worth pointing out that this particular error can only happen if an invalid value was passed to A better fix might be to remove this check and the |
Close file when
mpack_tree_init_stdfile()fails after checking its sizeLeak uncovered by gcc. Full trace: