mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
synced 2025-10-24 16:43:39 +00:00
mgcp: Fix a filedescriptor leak in case the bind is failing.
This commit is contained in:
@@ -346,6 +346,8 @@ static int create_bind(const char *source_addr, struct bsc_fd *fd, int port)
|
|||||||
inet_aton(source_addr, &addr.sin_addr);
|
inet_aton(source_addr, &addr.sin_addr);
|
||||||
|
|
||||||
if (bind(fd->fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
|
if (bind(fd->fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
|
||||||
|
close(fd->fd);
|
||||||
|
fd->fd = -1;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user