Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
8d44c52a
Commit
8d44c52a
authored
Apr 18, 2017
by
antirez
Browse files
Fix #3848 by closing the descriptor on error.
parent
5c107c62
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/anet.c
View file @
8d44c52a
...
@@ -464,7 +464,7 @@ static int anetV6Only(char *err, int s) {
...
@@ -464,7 +464,7 @@ static int anetV6Only(char *err, int s) {
static
int
_anetTcpServer
(
char
*
err
,
int
port
,
char
*
bindaddr
,
int
af
,
int
backlog
)
static
int
_anetTcpServer
(
char
*
err
,
int
port
,
char
*
bindaddr
,
int
af
,
int
backlog
)
{
{
int
s
,
rv
;
int
s
=
-
1
,
rv
;
char
_port
[
6
];
/* strlen("65535") */
char
_port
[
6
];
/* strlen("65535") */
struct
addrinfo
hints
,
*
servinfo
,
*
p
;
struct
addrinfo
hints
,
*
servinfo
,
*
p
;
...
@@ -493,6 +493,7 @@ static int _anetTcpServer(char *err, int port, char *bindaddr, int af, int backl
...
@@ -493,6 +493,7 @@ static int _anetTcpServer(char *err, int port, char *bindaddr, int af, int backl
}
}
error:
error:
if
(
s
!=
-
1
)
close
(
s
);
s
=
ANET_ERR
;
s
=
ANET_ERR
;
end:
end:
freeaddrinfo
(
servinfo
);
freeaddrinfo
(
servinfo
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment