summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2013-02-20 10:52:37 +0100
committerAlexander Bokovoy <ab@samba.org>2013-02-22 16:36:14 +0100
commit92b087182c047cd457bbe04d6306c50451698d61 (patch)
treeaedf5ac3cbb05498824ea0ec7de75b2f424c5d4c /source3
parent3ca727b2f98ca942040d5a6c54fe61bb268d75d9 (diff)
downloadsamba-92b087182c047cd457bbe04d6306c50451698d61.tar.gz
s3-rpc_server: Make sure that fd is really closed on error.
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_server/rpc_sock_helper.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source3/rpc_server/rpc_sock_helper.c b/source3/rpc_server/rpc_sock_helper.c
index 198df903ad4..dc88f25a900 100644
--- a/source3/rpc_server/rpc_sock_helper.c
+++ b/source3/rpc_server/rpc_sock_helper.c
@@ -63,6 +63,9 @@ NTSTATUS rpc_create_tcpip_sockets(const struct ndr_interface_table *iface,
fd = create_tcpip_socket(ifss, &p);
if (fd < 0 || p == 0) {
status = NT_STATUS_UNSUCCESSFUL;
+ if (fd != -1) {
+ close(fd);
+ }
goto done;
}
listen_fd[*listen_fd_size] = fd;
@@ -124,6 +127,9 @@ NTSTATUS rpc_create_tcpip_sockets(const struct ndr_interface_table *iface,
fd = create_tcpip_socket(&ss, &p);
if (fd < 0 || p == 0) {
status = NT_STATUS_UNSUCCESSFUL;
+ if (fd != -1) {
+ close(fd);
+ }
goto done;
}
listen_fd[*listen_fd_size] = fd;