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
c41021da
Commit
c41021da
authored
Mar 01, 2012
by
Youness Alaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix memory leak with udp-bsd
parent
26262bb7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
socket/udp-bsd.c
socket/udp-bsd.c
+12
-11
No files found.
socket/udp-bsd.c
View file @
c41021da
...
...
@@ -67,10 +67,9 @@ NiceSocket *
nice_udp_bsd_socket_new
(
NiceAddress
*
addr
)
{
struct
sockaddr_storage
name
;
socklen_t
name_len
=
sizeof
(
name
);
NiceSocket
*
sock
=
g_slice_new0
(
NiceSocket
);
GSocket
*
gsock
=
NULL
;
gboolean
gret
;
gboolean
gret
=
FALSE
;
GSocketAddress
*
gaddr
;
if
(
addr
!=
NULL
)
{
...
...
@@ -100,13 +99,15 @@ nice_udp_bsd_socket_new (NiceAddress *addr)
g_slice_free
(
NiceSocket
,
sock
);
return
NULL
;
}
/* GSocket: All socket file descriptors are set to be close-on-exec. */
g_socket_set_blocking
(
gsock
,
false
);
name_len
=
name
.
ss_family
==
AF_INET
?
sizeof
(
struct
sockaddr_in
)
:
sizeof
(
struct
sockaddr_in6
);
/* GSocket: All socket file descriptors are set to be close-on-exec. */
g_socket_set_blocking
(
gsock
,
false
);
gaddr
=
g_socket_address_new_from_native
(
&
name
,
sizeof
(
name
));
if
(
gaddr
!=
NULL
)
{
gret
=
g_socket_bind
(
gsock
,
gaddr
,
FALSE
,
NULL
);
g_object_unref
(
gaddr
);
}
gret
=
g_socket_bind
(
gsock
,
g_socket_address_new_from_native
(
&
name
,
name_len
),
FALSE
,
NULL
);
if
(
gret
==
FALSE
)
{
g_slice_free
(
NiceSocket
,
sock
);
g_socket_close
(
gsock
,
NULL
);
...
...
@@ -114,16 +115,16 @@ nice_udp_bsd_socket_new (NiceAddress *addr)
return
NULL
;
}
gaddr
=
g_socket_get_local_address
(
gsock
,
NULL
);
if
(
gaddr
==
NULL
)
{
gaddr
=
g_socket_get_local_address
(
gsock
,
NULL
);
if
(
gaddr
==
NULL
||
!
g_socket_address_to_native
(
gaddr
,
&
name
,
sizeof
(
name
),
NULL
))
{
g_slice_free
(
NiceSocket
,
sock
);
g_socket_close
(
gsock
,
NULL
);
g_object_unref
(
gsock
);
return
NULL
;
}
g_socket_address_to_native
(
gaddr
,
&
name
,
name_len
,
NULL
);
g_object_unref
(
gaddr
);
g_object_unref
(
gaddr
);
nice_address_set_from_sockaddr
(
&
sock
->
addr
,
(
struct
sockaddr
*
)
&
name
);
...
...
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