Files
codeql/cpp/ql/src/Critical/DescriptorMayNotBeClosed.cpp
2018-09-23 16:23:52 -07:00

10 lines
260 B
C++

int f() {
try {
int sockfd = socket(AF_INET, SOCK_STREAM, 0);
do_stuff(sockfd);
return sockfd; //if there are no exceptions, the socket is returned
} catch (int do_stuff_exception) {
return -1; //return error value, but sockfd may still be open
}
}