Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
686fbd9c
Commit
686fbd9c
authored
Aug 13, 2008
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check asprintf return value and fix memleak.
parent
f678aa83
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
19 deletions
+23
-19
src/input/vlm.c
src/input/vlm.c
+23
-19
No files found.
src/input/vlm.c
View file @
686fbd9c
...
...
@@ -124,19 +124,17 @@ vlm_t *__vlm_New ( vlc_object_t *p_this )
char
*
psz_buffer
=
NULL
;
msg_Dbg
(
p_this
,
"loading VLM configuration"
);
if
(
asprintf
(
&
psz_buffer
,
"load %s"
,
psz_vlmconf
)
==
-
1
)
psz_buffer
=
NULL
;
if
(
psz_buffer
)
if
(
asprintf
(
&
psz_buffer
,
"load %s"
,
psz_vlmconf
)
!=
-
1
)
{
msg_Dbg
(
p_this
,
psz_buffer
);
if
(
vlm_ExecuteCommand
(
p_vlm
,
psz_buffer
,
&
p_message
)
)
msg_Warn
(
p_this
,
"error while loading the configuration file"
);
vlm_MessageDelete
(
p_message
);
free
(
psz_buffer
);
vlm_MessageDelete
(
p_message
);
free
(
psz_buffer
);
}
}
free
(
psz_vlmconf
);
free
(
psz_vlmconf
);
vlc_object_set_destructor
(
p_vlm
,
(
vlc_destructor_t
)
vlm_Destructor
);
*
pp_vlm
=
p_vlm
;
/* for future reference */
...
...
@@ -510,17 +508,19 @@ static int vlm_OnMediaUpdate( vlm_t *p_vlm, vlm_media_sys_t *p_media )
else
psz_output
=
strdup
(
"#description"
);
if
(
psz_output
&&
asprintf
(
&
psz_dup
,
"sout=%s"
,
psz_output
)
!=
-
1
)
if
(
psz_output
&&
asprintf
(
&
psz_dup
,
"sout=%s"
,
psz_output
)
!=
-
1
)
{
input_ItemAddOption
(
p_media
->
vod
.
p_item
,
psz_dup
);
free
(
psz_output
);
free
(
psz_dup
);
}
free
(
psz_output
);
for
(
i
=
0
;
i
<
p_cfg
->
i_option
;
i
++
)
input_ItemAddOption
(
p_media
->
vod
.
p_item
,
p_cfg
->
ppsz_option
[
i
]
);
asprintf
(
&
psz_header
,
_
(
"Media: %s"
),
p_cfg
->
psz_name
);
if
(
asprintf
(
&
psz_header
,
_
(
"Media: %s"
),
p_cfg
->
psz_name
)
==
-
1
)
psz_header
=
NULL
;
if
(
(
p_input
=
input_CreateThreadExtended
(
p_vlm
,
p_media
->
vod
.
p_item
,
psz_header
,
NULL
)
)
)
{
...
...
@@ -804,12 +804,14 @@ static int vlm_ControlMediaInstanceStart( vlm_t *p_vlm, int64_t id, const char *
if
(
p_cfg
->
psz_output
!=
NULL
||
psz_vod_output
!=
NULL
)
{
char
*
psz_buffer
;
asprintf
(
&
psz_buffer
,
"sout=%s%s%s"
,
if
(
asprintf
(
&
psz_buffer
,
"sout=%s%s%s"
,
p_cfg
->
psz_output
?
p_cfg
->
psz_output
:
""
,
(
p_cfg
->
psz_output
&&
psz_vod_output
)
?
":"
:
psz_vod_output
?
"#"
:
""
,
psz_vod_output
?
psz_vod_output
:
""
);
input_ItemAddOption
(
p_instance
->
p_item
,
psz_buffer
);
free
(
psz_buffer
);
psz_vod_output
?
psz_vod_output
:
""
)
!=
-
1
)
{
input_ItemAddOption
(
p_instance
->
p_item
,
psz_buffer
);
free
(
psz_buffer
);
}
}
for
(
i
=
0
;
i
<
p_cfg
->
i_option
;
i
++
)
...
...
@@ -849,14 +851,16 @@ static int vlm_ControlMediaInstanceStart( vlm_t *p_vlm, int64_t id, const char *
p_instance
->
i_index
=
i_input_index
;
input_item_SetURI
(
p_instance
->
p_item
,
p_media
->
cfg
.
ppsz_input
[
p_instance
->
i_index
]
)
;
asprintf
(
&
psz_log
,
_
(
"Media: %s"
),
p_media
->
cfg
.
psz_name
);
p_instance
->
p_input
=
input_CreateThreadExtended
(
p_vlm
,
p_instance
->
p_item
,
psz_log
,
p_instance
->
p_sout
);
if
(
!
p_instance
->
p_input
)
if
(
asprintf
(
&
psz_log
,
_
(
"Media: %s"
),
p_media
->
cfg
.
psz_name
)
!=
-
1
)
{
TAB_REMOVE
(
p_media
->
i_instance
,
p_media
->
instance
,
p_instance
);
vlm_MediaInstanceDelete
(
p_instance
);
p_instance
->
p_input
=
input_CreateThreadExtended
(
p_vlm
,
p_instance
->
p_item
,
psz_log
,
p_instance
->
p_sout
);
if
(
!
p_instance
->
p_input
)
{
TAB_REMOVE
(
p_media
->
i_instance
,
p_media
->
instance
,
p_instance
);
vlm_MediaInstanceDelete
(
p_instance
);
}
free
(
psz_log
);
}
free
(
psz_log
);
return
VLC_SUCCESS
;
}
...
...
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