Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
1f7b5271
Commit
1f7b5271
authored
Oct 10, 2019
by
Steven Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/libsrt: check av_strdup() return value and fix memleak
Signed-off-by:
Steven Liu
<
lq@chinaffmpeg.org
>
parent
17d96c15
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
libsrt.c
libavformat/libsrt.c
+15
-1
No files found.
libavformat/libsrt.c
View file @
1f7b5271
...
...
@@ -478,6 +478,7 @@ static int libsrt_open(URLContext *h, const char *uri, int flags)
SRTContext
*
s
=
h
->
priv_data
;
const
char
*
p
;
char
buf
[
256
];
int
ret
=
0
;
if
(
srt_startup
()
<
0
)
{
return
AVERROR_UNKNOWN
;
...
...
@@ -564,10 +565,18 @@ static int libsrt_open(URLContext *h, const char *uri, int flags)
if
(
av_find_info_tag
(
buf
,
sizeof
(
buf
),
"streamid"
,
p
))
{
av_freep
(
&
s
->
streamid
);
s
->
streamid
=
av_strdup
(
buf
);
if
(
!
s
->
streamid
)
{
ret
=
AVERROR
(
ENOMEM
);
goto
err
;
}
}
if
(
av_find_info_tag
(
buf
,
sizeof
(
buf
),
"smoother"
,
p
))
{
av_freep
(
&
s
->
smoother
);
s
->
smoother
=
av_strdup
(
buf
);
if
(
!
s
->
smoother
)
{
ret
=
AVERROR
(
ENOMEM
);
goto
err
;
}
}
if
(
av_find_info_tag
(
buf
,
sizeof
(
buf
),
"messageapi"
,
p
))
{
s
->
messageapi
=
strtol
(
buf
,
NULL
,
10
);
...
...
@@ -578,11 +587,16 @@ static int libsrt_open(URLContext *h, const char *uri, int flags)
}
else
if
(
!
strcmp
(
buf
,
"file"
))
{
s
->
transtype
=
SRTT_FILE
;
}
else
{
return
AVERROR
(
EINVAL
);
ret
=
AVERROR
(
EINVAL
);
goto
err
;
}
}
}
return
libsrt_setup
(
h
,
uri
,
flags
);
err:
av_freep
(
&
s
->
smoother
);
av_freep
(
&
s
->
streamid
);
return
ret
;
}
static
int
libsrt_read
(
URLContext
*
h
,
uint8_t
*
buf
,
int
size
)
...
...
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