Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
5f2b369c
Commit
5f2b369c
authored
Jul 09, 2008
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't leak memory when something goes wrong.
parent
6ce6dc06
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
13 deletions
+19
-13
modules/access/jack.c
modules/access/jack.c
+19
-13
No files found.
modules/access/jack.c
View file @
5f2b369c
...
@@ -143,10 +143,7 @@ static int Open( vlc_object_t *p_this )
...
@@ -143,10 +143,7 @@ static int Open( vlc_object_t *p_this )
/* Allocate structure */
/* Allocate structure */
p_demux
->
p_sys
=
p_sys
=
calloc
(
1
,
sizeof
(
demux_sys_t
)
);
p_demux
->
p_sys
=
p_sys
=
calloc
(
1
,
sizeof
(
demux_sys_t
)
);
if
(
p_sys
==
NULL
)
if
(
p_sys
==
NULL
)
{
msg_Err
(
p_demux
,
"out of memory, cannot allocate structure"
);
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
}
memset
(
p_sys
,
0
,
sizeof
(
demux_sys_t
)
);
memset
(
p_sys
,
0
,
sizeof
(
demux_sys_t
)
);
/* Parse MRL */
/* Parse MRL */
...
@@ -188,7 +185,8 @@ static int Open( vlc_object_t *p_this )
...
@@ -188,7 +185,8 @@ static int Open( vlc_object_t *p_this )
p_sys
->
i_channels
*
sizeof
(
jack_port_t
*
)
);
p_sys
->
i_channels
*
sizeof
(
jack_port_t
*
)
);
if
(
p_sys
->
pp_jack_port_input
==
NULL
)
if
(
p_sys
->
pp_jack_port_input
==
NULL
)
{
{
msg_Err
(
p_demux
,
"out of memory, cannot allocate input ports"
);
jack_client_close
(
p_sys
->
p_jack_client
);
free
(
p_sys
);
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
}
}
...
@@ -200,7 +198,9 @@ static int Open( vlc_object_t *p_this )
...
@@ -200,7 +198,9 @@ static int Open( vlc_object_t *p_this )
*
sizeof
(
jack_default_audio_sample_t
)
);
*
sizeof
(
jack_default_audio_sample_t
)
);
if
(
p_sys
->
p_jack_ringbuffer
==
NULL
)
if
(
p_sys
->
p_jack_ringbuffer
==
NULL
)
{
{
msg_Err
(
p_demux
,
"out of memory, cannot allocate ringbuffer"
);
free
(
p_sys
->
pp_jack_port_input
);
jack_client_close
(
p_sys
->
p_jack_client
);
free
(
p_sys
);
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
}
}
...
@@ -215,10 +215,9 @@ static int Open( vlc_object_t *p_this )
...
@@ -215,10 +215,9 @@ static int Open( vlc_object_t *p_this )
if
(
p_sys
->
pp_jack_port_input
[
i
]
==
NULL
)
if
(
p_sys
->
pp_jack_port_input
[
i
]
==
NULL
)
{
{
msg_Err
(
p_demux
,
"failed to register a JACK port"
);
msg_Err
(
p_demux
,
"failed to register a JACK port"
);
if
(
p_sys
->
p_jack_client
)
jack_client_close
(
p_sys
->
p_jack_client
);
jack_ringbuffer_free
(
p_sys
->
p_jack_ringbuffer
);
free
(
p_sys
->
pp_jack_port_input
);
free
(
p_sys
->
pp_jack_port_input
);
if
(
p_sys
->
p_jack_ringbuffer
)
jack_ringbuffer_free
(
p_sys
->
p_jack_ringbuffer
);
jack_client_close
(
p_sys
->
p_jack_client
);
free
(
p_sys
->
pp_jack_buffer
);
free
(
p_sys
);
free
(
p_sys
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
@@ -229,7 +228,12 @@ static int Open( vlc_object_t *p_this )
...
@@ -229,7 +228,12 @@ static int Open( vlc_object_t *p_this )
*
sizeof
(
jack_default_audio_sample_t
*
)
);
*
sizeof
(
jack_default_audio_sample_t
*
)
);
if
(
p_sys
->
pp_jack_buffer
==
NULL
)
if
(
p_sys
->
pp_jack_buffer
==
NULL
)
{
{
msg_Err
(
p_demux
,
"out of memory, cannot allocate input buffer"
);
for
(
i
=
0
;
i
<
p_sys
->
i_channels
;
i
++
)
jack_port_unregister
(
p_sys
->
p_jack_client
,
p_sys
->
pp_jack_port_input
[
i
]
);
jack_ringbuffer_free
(
p_sys
->
p_jack_ringbuffer
);
free
(
p_sys
->
pp_jack_port_input
);
jack_client_close
(
p_sys
->
p_jack_client
);
free
(
p_sys
);
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
}
}
...
@@ -240,10 +244,12 @@ static int Open( vlc_object_t *p_this )
...
@@ -240,10 +244,12 @@ static int Open( vlc_object_t *p_this )
if
(
jack_activate
(
p_sys
->
p_jack_client
)
)
if
(
jack_activate
(
p_sys
->
p_jack_client
)
)
{
{
msg_Err
(
p_demux
,
"failed to activate JACK client"
);
msg_Err
(
p_demux
,
"failed to activate JACK client"
);
if
(
p_sys
->
p_jack_client
)
jack_client_close
(
p_sys
->
p_jack_client
);
free
(
p_sys
->
pp_jack_port_input
);
if
(
p_sys
->
p_jack_ringbuffer
)
jack_ringbuffer_free
(
p_sys
->
p_jack_ringbuffer
);
free
(
p_sys
->
pp_jack_buffer
);
free
(
p_sys
->
pp_jack_buffer
);
for
(
i
=
0
;
i
<
p_sys
->
i_channels
;
i
++
)
jack_port_unregister
(
p_sys
->
p_jack_client
,
p_sys
->
pp_jack_port_input
[
i
]
);
jack_ringbuffer_free
(
p_sys
->
p_jack_ringbuffer
);
free
(
p_sys
->
pp_jack_port_input
);
jack_client_close
(
p_sys
->
p_jack_client
);
free
(
p_sys
);
free
(
p_sys
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
@@ -288,7 +294,7 @@ static int Open( vlc_object_t *p_this )
...
@@ -288,7 +294,7 @@ static int Open( vlc_object_t *p_this )
jack_port_name
(
p_sys
->
pp_jack_port_input
[
i_input_ports
]
)
);
jack_port_name
(
p_sys
->
pp_jack_port_input
[
i_input_ports
]
)
);
}
}
}
}
free
(
pp_jack_port_output
);
free
(
pp_jack_port_output
);
}
}
/* info about jack server */
/* info about jack server */
...
...
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