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
6816d2d5
Commit
6816d2d5
authored
Mar 31, 2011
by
Timothy Redaelli
Committed by
Youness Alaoui
Mar 31, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a (possible) memory leak in nice_turn_socket_new and in a test
parent
17f2117b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
socket/turn.c
socket/turn.c
+3
-1
tests/test-pseudotcp.c
tests/test-pseudotcp.c
+3
-1
No files found.
socket/turn.c
View file @
6816d2d5
...
@@ -166,13 +166,15 @@ nice_turn_socket_new (NiceAgent *agent, NiceAddress *addr,
...
@@ -166,13 +166,15 @@ nice_turn_socket_new (NiceAgent *agent, NiceAddress *addr,
gchar
*
username
,
gchar
*
password
,
gchar
*
username
,
gchar
*
password
,
NiceTurnSocketCompatibility
compatibility
)
NiceTurnSocketCompatibility
compatibility
)
{
{
TurnPriv
*
priv
=
g_new0
(
TurnPriv
,
1
)
;
TurnPriv
*
priv
;
NiceSocket
*
sock
=
g_slice_new0
(
NiceSocket
);
NiceSocket
*
sock
=
g_slice_new0
(
NiceSocket
);
if
(
!
sock
)
{
if
(
!
sock
)
{
return
NULL
;
return
NULL
;
}
}
priv
=
g_new0
(
TurnPriv
,
1
);
if
(
compatibility
==
NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9
||
if
(
compatibility
==
NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9
||
compatibility
==
NICE_TURN_SOCKET_COMPATIBILITY_RFC5766
)
{
compatibility
==
NICE_TURN_SOCKET_COMPATIBILITY_RFC5766
)
{
stun_agent_init
(
&
priv
->
agent
,
STUN_ALL_KNOWN_ATTRIBUTES
,
stun_agent_init
(
&
priv
->
agent
,
STUN_ALL_KNOWN_ATTRIBUTES
,
...
...
tests/test-pseudotcp.c
View file @
6816d2d5
...
@@ -174,7 +174,7 @@ static gboolean notify_packet (gpointer user_data)
...
@@ -174,7 +174,7 @@ static gboolean notify_packet (gpointer user_data)
static
PseudoTcpWriteResult
write
(
PseudoTcpSocket
*
sock
,
static
PseudoTcpWriteResult
write
(
PseudoTcpSocket
*
sock
,
const
gchar
*
buffer
,
guint32
len
,
gpointer
user_data
)
const
gchar
*
buffer
,
guint32
len
,
gpointer
user_data
)
{
{
struct
notify_data
*
data
=
g_new0
(
struct
notify_data
,
1
)
;
struct
notify_data
*
data
;
PseudoTcpState
state
;
PseudoTcpState
state
;
int
drop_rate
=
rand
()
%
100
;
int
drop_rate
=
rand
()
%
100
;
g_object_get
(
sock
,
"state"
,
&
state
,
NULL
);
g_object_get
(
sock
,
"state"
,
&
state
,
NULL
);
...
@@ -184,6 +184,8 @@ static PseudoTcpWriteResult write (PseudoTcpSocket *sock,
...
@@ -184,6 +184,8 @@ static PseudoTcpWriteResult write (PseudoTcpSocket *sock,
return
WR_SUCCESS
;
return
WR_SUCCESS
;
}
}
data
=
g_new0
(
struct
notify_data
,
1
);
g_debug
(
"Socket %p(%d) Writing : %d bytes"
,
sock
,
state
,
len
);
g_debug
(
"Socket %p(%d) Writing : %d bytes"
,
sock
,
state
,
len
);
data
->
buffer
=
g_malloc
(
len
);
data
->
buffer
=
g_malloc
(
len
);
...
...
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