Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
c0eb3e56
Commit
c0eb3e56
authored
May 10, 2013
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Not using realloc2 in set_ports_option
parent
5591aa5a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
mongoose.c
mongoose.c
+8
-8
No files found.
mongoose.c
View file @
c0eb3e56
...
...
@@ -4547,7 +4547,7 @@ static int set_ports_option(struct mg_context *ctx) {
int
off
=
0
;
#endif
struct
vec
vec
;
struct
socket
so
;
struct
socket
so
,
*
ptr
;
while
(
success
&&
(
list
=
next_option
(
list
,
&
vec
,
NULL
))
!=
NULL
)
{
if
(
!
parse_port_string
(
&
vec
,
&
so
))
{
...
...
@@ -4573,17 +4573,17 @@ static int set_ports_option(struct mg_context *ctx) {
(
int
)
vec
.
len
,
vec
.
ptr
,
strerror
(
ERRNO
));
closesocket
(
so
.
sock
);
success
=
0
;
}
else
if
((
ptr
=
realloc
(
ctx
->
listening_sockets
,
(
ctx
->
num_listening_sockets
+
1
)
*
sizeof
(
ctx
->
listening_sockets
[
0
])))
==
NULL
)
{
success
=
0
;
}
else
{
set_close_on_exec
(
so
.
sock
);
ctx
->
listening_sockets
=
realloc2
(
ctx
->
listening_sockets
,
(
ctx
->
num_listening_sockets
+
1
)
*
sizeof
(
ctx
->
listening_sockets
[
0
]));
if
(
ctx
->
listening_sockets
!=
NULL
)
{
ctx
->
listening_sockets
=
ptr
;
ctx
->
listening_sockets
[
ctx
->
num_listening_sockets
]
=
so
;
ctx
->
num_listening_sockets
++
;
}
}
}
if
(
!
success
)
{
close_all_listening_sockets
(
ctx
);
...
...
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