Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libnice
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
libnice
Commits
8b6568da
Commit
8b6568da
authored
Oct 06, 2008
by
Youness Alaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean discovery_add_local_host_candidate to avoid memleaks if an error occurs
parent
02fd911e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
45 deletions
+40
-45
agent/discovery.c
agent/discovery.c
+40
-45
No files found.
agent/discovery.c
View file @
8b6568da
...
@@ -289,8 +289,6 @@ NiceCandidate *discovery_add_local_host_candidate (
...
@@ -289,8 +289,6 @@ NiceCandidate *discovery_add_local_host_candidate (
candidate
=
nice_candidate_new
(
NICE_CANDIDATE_TYPE_HOST
);
candidate
=
nice_candidate_new
(
NICE_CANDIDATE_TYPE_HOST
);
if
(
candidate
)
{
if
(
candidate
)
{
NiceUDPSocket
*
udp_socket
=
g_slice_new0
(
NiceUDPSocket
);
if
(
udp_socket
)
{
candidate
->
stream_id
=
stream_id
;
candidate
->
stream_id
=
stream_id
;
candidate
->
component_id
=
component_id
;
candidate
->
component_id
=
component_id
;
candidate
->
addr
=
*
address
;
candidate
->
addr
=
*
address
;
...
@@ -308,12 +306,11 @@ NiceCandidate *discovery_add_local_host_candidate (
...
@@ -308,12 +306,11 @@ NiceCandidate *discovery_add_local_host_candidate (
/* note: candidate username and password are left NULL as stream
/* note: candidate username and password are left NULL as stream
level ufrag/password are used */
level ufrag/password are used */
if
(
nice_udp_socket_factory_make
(
&
agent
->
udp_socket_factory
,
udp_socket
=
nice_socket_new
(
agent
->
udp_socket_factory
,
address
);
udp_socket
,
address
)
)
{
if
(
udp_socket
)
{
gboolean
result
;
gboolean
result
;
priv_attach_stream_component_socket
(
agent
,
stream
,
component
,
priv_attach_stream_component_socket
(
agent
,
stream
,
component
,
udp_socket
);
udp_socket
);
candidate
->
sockptr
=
udp_socket
;
candidate
->
sockptr
=
udp_socket
;
candidate
->
addr
=
udp_socket
->
addr
;
candidate
->
addr
=
udp_socket
->
addr
;
...
@@ -327,19 +324,17 @@ NiceCandidate *discovery_add_local_host_candidate (
...
@@ -327,19 +324,17 @@ NiceCandidate *discovery_add_local_host_candidate (
/* success: store a pointer to the sockaddr */
/* success: store a pointer to the sockaddr */
component
->
sockets
=
modified_list
;
component
->
sockets
=
modified_list
;
agent_signal_new_candidate
(
agent
,
candidate
);
agent_signal_new_candidate
(
agent
,
candidate
);
}
}
else
{
/* error: list memory allocation */
else
{
/* error: list memory allocation */
candidate
=
NULL
;
/* note: candidate already owned by component */
candidate
=
NULL
;
/* note: candidate already owned by component */
}
}
}
}
else
{
else
/* error: memory allocation, or duplicate candidatet
*/
/* error: memory allocation, or duplicate candidates
*/
errors
=
TRUE
;
errors
=
TRUE
;
}
}
else
/* error: socket factory make */
}
else
{
/* error: socket new */
errors
=
TRUE
;
errors
=
TRUE
;
}
}
else
/* error: udp socket memory allocation */
errors
=
TRUE
;
}
}
/* clean up after errors */
/* clean up after errors */
...
...
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