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
a43c6c83
Commit
a43c6c83
authored
Apr 22, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
smooth: memory leak
parent
c84703a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
23 deletions
+19
-23
modules/stream_filter/smooth/smooth.c
modules/stream_filter/smooth/smooth.c
+19
-23
No files found.
modules/stream_filter/smooth/smooth.c
View file @
a43c6c83
...
...
@@ -72,41 +72,37 @@ static int Control( stream_t *, int , va_list );
static
bool
isSmoothStreaming
(
stream_t
*
s
)
{
const
uint8_t
*
peek
;
const
char
*
needle
=
"<SmoothStreamingMedia"
;
const
char
*
encoding
=
NULL
;
bool
ret
=
false
;
int
i_size
=
stream_Peek
(
s
->
p_source
,
&
peek
,
512
);
if
(
i_size
<
512
)
return
false
;
char
*
peeked
=
malloc
(
512
);
if
(
unlikely
(
!
peeked
)
)
if
(
unlikely
(
peeked
==
NULL
)
)
return
false
;
memcpy
(
peeked
,
peek
,
512
);
peeked
[
511
]
=
peeked
[
510
]
=
'\0'
;
if
(
strstr
(
(
const
char
*
)
peeked
,
needle
)
!=
NULL
)
ret
=
true
;
else
/* maybe it's utf-16 encoding, should we also test other encodings? */
{
if
(
!
memcmp
(
peeked
,
"
\xFF\xFE
"
,
2
)
)
encoding
=
"UTF-16LE"
;
else
if
(
!
memcmp
(
peeked
,
"
\xFE\xFF
"
,
2
)
)
encoding
=
"UTF-16BE"
;
else
{
free
(
peeked
);
return
false
;
}
peeked
=
FromCharset
(
encoding
,
peeked
,
512
);
char
*
str
;
if
(
peeked
!=
NULL
&&
strstr
(
peeked
,
needle
)
!=
NULL
)
ret
=
true
;
if
(
!
memcmp
(
peeked
,
"
\xFF\xFE
"
,
2
)
)
{
str
=
FromCharset
(
"UTF-16LE"
,
peeked
,
512
);
free
(
peeked
);
}
free
(
peeked
);
else
if
(
!
memcmp
(
peeked
,
"
\xFE\xFF
"
,
2
)
)
{
str
=
FromCharset
(
"UTF-16BE"
,
peeked
,
512
);
free
(
peeked
);
}
else
str
=
peeked
;
if
(
str
==
NULL
)
return
false
;
bool
ret
=
strstr
(
str
,
"<SmoothStreamingMedia"
)
!=
NULL
;
free
(
str
);
return
ret
;
}
...
...
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