summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openbsc/src/mgcp/mgcp_network.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/openbsc/src/mgcp/mgcp_network.c b/openbsc/src/mgcp/mgcp_network.c
index bbc46f418..2123db77c 100644
--- a/openbsc/src/mgcp/mgcp_network.c
+++ b/openbsc/src/mgcp/mgcp_network.c
@@ -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);
if (bind(fd->fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
+ close(fd->fd);
+ fd->fd = -1;
return -1;
}