iperf
iperf copied to clipboard
Add error handling for close socket
-
Development branch: master
-
Issues fixed: add error handling for correct closing of socket
sbecause of return with close socket leads to descriptor leak(CWE-403). -
Brief description of code changes: added
gotolabel with correct exit from function if necessary.
@maks-mishin this isn't correct, mark of error_handling must be after return 0, now the function always return -1 probably you should added variable int ret and initialize it 0, and in error cases
ret = -1;
goto error_handling;
...
error_handling:
close(s);
return ret;
p.s. not memleak, file descriptor leak(CWE-403)
@ProjectMutilation, thanks for comments and advice. I will fix it in the next commit.