Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
videolan
vlc
Commits
35738e89
Commit
35738e89
authored
Oct 06, 2014
by
Ludovic Fauvet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chromecast: fix TLS connection leak on error
Signed-off-by:
Adrien Maglo
<
magsoft@videolan.org
>
parent
86723f34
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
17 deletions
+17
-17
modules/stream_out/chromecast/cast.cpp
modules/stream_out/chromecast/cast.cpp
+17
-17
No files found.
modules/stream_out/chromecast/cast.cpp
View file @
35738e89
...
...
@@ -69,7 +69,7 @@ enum
struct
sout_stream_sys_t
{
sout_stream_sys_t
()
:
i_status
(
CHROMECAST_DISCONNECTED
),
p_out
(
NULL
)
:
p_tls
(
NULL
),
i_status
(
CHROMECAST_DISCONNECTED
),
p_out
(
NULL
)
{
atomic_init
(
&
ab_error
,
false
);
}
...
...
@@ -115,7 +115,7 @@ struct sout_stream_sys_t
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
void
Clean
(
sout_stream_
sys_t
*
p_sys
);
static
void
Clean
(
sout_stream_
t
*
p_stream
);
static
int
connectChromecast
(
sout_stream_t
*
p_stream
,
char
*
psz_ipChromecast
);
static
void
disconnectChromecast
(
sout_stream_t
*
p_stream
);
static
int
sendMessages
(
sout_stream_t
*
p_stream
);
...
...
@@ -213,7 +213,7 @@ static int Open(vlc_object_t *p_this)
if
(
psz_ipChromecast
==
NULL
)
{
msg_Err
(
p_stream
,
"No Chromecast receiver IP provided"
);
Clean
(
p_s
ys
);
Clean
(
p_s
tream
);
return
VLC_EGENERIC
;
}
...
...
@@ -222,7 +222,7 @@ static int Open(vlc_object_t *p_this)
if
(
p_sys
->
i_sock_fd
<
0
)
{
msg_Err
(
p_stream
,
"Could not connect the Chromecast"
);
Clean
(
p_s
ys
);
Clean
(
p_s
tream
);
return
VLC_EGENERIC
;
}
p_sys
->
i_status
=
CHROMECAST_TLS_CONNECTED
;
...
...
@@ -231,7 +231,7 @@ static int Open(vlc_object_t *p_this)
if
(
net_GetSockAddress
(
p_sys
->
i_sock_fd
,
psz_localIP
,
NULL
))
{
msg_Err
(
p_this
,
"Cannot get local IP address"
);
Clean
(
p_s
ys
);
Clean
(
p_s
tream
);
return
VLC_EGENERIC
;
}
p_sys
->
serverIP
=
psz_localIP
;
...
...
@@ -239,7 +239,7 @@ static int Open(vlc_object_t *p_this)
char
*
psz_mux
=
var_GetNonEmptyString
(
p_stream
,
SOUT_CFG_PREFIX
"mux"
);
if
(
psz_mux
==
NULL
)
{
Clean
(
p_s
ys
);
Clean
(
p_s
tream
);
return
VLC_EGENERIC
;
}
char
*
psz_chain
=
NULL
;
...
...
@@ -249,7 +249,7 @@ static int Open(vlc_object_t *p_this)
free
(
psz_mux
);
if
(
i_bytes
<
0
)
{
Clean
(
p_s
ys
);
Clean
(
p_s
tream
);
return
VLC_EGENERIC
;
}
...
...
@@ -257,7 +257,7 @@ static int Open(vlc_object_t *p_this)
free
(
psz_chain
);
if
(
p_sys
->
p_out
==
NULL
)
{
Clean
(
p_s
ys
);
Clean
(
p_s
tream
);
return
VLC_EGENERIC
;
}
...
...
@@ -269,7 +269,7 @@ static int Open(vlc_object_t *p_this)
VLC_THREAD_PRIORITY_LOW
))
{
msg_Err
(
p_stream
,
"Could not start the Chromecast talking thread"
);
Clean
(
p_s
ys
);
Clean
(
p_s
tream
);
return
VLC_EGENERIC
;
}
...
...
@@ -290,7 +290,7 @@ static int Open(vlc_object_t *p_this)
msg_Err
(
p_stream
,
"Timeout reached before sending the media loading command"
);
vlc_cancel
(
p_sys
->
chromecastThread
);
vlc_join
(
p_sys
->
chromecastThread
,
NULL
);
Clean
(
p_s
ys
);
Clean
(
p_s
tream
);
return
VLC_EGENERIC
;
}
...
...
@@ -330,24 +330,21 @@ static void Close(vlc_object_t *p_this)
// Send the just added close messages.
sendMessages
(
p_stream
);
// ft
case
CHROMECAST_TLS_CONNECTED
:
case
CHROMECAST_CONNECTION_DEAD
:
disconnectChromecast
(
p_stream
);
p_sys
->
i_status
=
CHROMECAST_DISCONNECTED
;
// ft
default:
break
;
}
Clean
(
p_s
ys
);
Clean
(
p_s
tream
);
}
/**
* @brief Clean and release the variables in a sout_stream_sys_t structure
*/
static
void
Clean
(
sout_stream_
sys_t
*
p_sys
)
static
void
Clean
(
sout_stream_
t
*
p_stream
)
{
sout_stream_sys_t
*
p_sys
=
p_stream
->
p_sys
;
if
(
p_sys
->
p_out
)
{
vlc_mutex_destroy
(
&
p_sys
->
lock
);
...
...
@@ -355,6 +352,8 @@ static void Clean(sout_stream_sys_t *p_sys)
sout_StreamChainDelete
(
p_sys
->
p_out
,
p_sys
->
p_out
);
}
disconnectChromecast
(
p_stream
);
delete
p_sys
;
}
...
...
@@ -400,6 +399,7 @@ static void disconnectChromecast(sout_stream_t *p_stream)
vlc_tls_SessionDelete
(
p_sys
->
p_tls
);
vlc_tls_Delete
(
p_sys
->
p_creds
);
p_sys
->
p_tls
=
NULL
;
p_sys
->
i_status
=
CHROMECAST_DISCONNECTED
;
}
}
...
...
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