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
834d3847
Commit
834d3847
authored
Dec 15, 2008
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mms/mmstu: fix a memleak and avoid to memcpy two times the same thing
(but yes duplicate 2 lines of code).
parent
428d84df
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
9 deletions
+5
-9
modules/access/mms/mmstu.c
modules/access/mms/mmstu.c
+5
-9
No files found.
modules/access/mms/mmstu.c
View file @
834d3847
...
@@ -1256,9 +1256,6 @@ static int mms_ParsePacket( access_t *p_access,
...
@@ -1256,9 +1256,6 @@ static int mms_ParsePacket( access_t *p_access,
size_t
i_packet_length
;
size_t
i_packet_length
;
uint32_t
i_packet_id
;
uint32_t
i_packet_id
;
uint8_t
*
p_packet
;
*
pi_used
=
i_data
;
/* default */
*
pi_used
=
i_data
;
/* default */
if
(
i_data
<=
8
)
if
(
i_data
<=
8
)
{
{
...
@@ -1300,9 +1297,6 @@ static int mms_ParsePacket( access_t *p_access,
...
@@ -1300,9 +1297,6 @@ static int mms_ParsePacket( access_t *p_access,
}
}
/* we now have a media or a header packet */
/* we now have a media or a header packet */
p_packet
=
malloc
(
i_packet_length
-
8
);
// don't bother with preheader
memcpy
(
p_packet
,
p_data
+
8
,
i_packet_length
-
8
);
if
(
i_packet_seq_num
!=
p_sys
->
i_packet_seq_num
)
if
(
i_packet_seq_num
!=
p_sys
->
i_packet_seq_num
)
{
{
#if 0
#if 0
...
@@ -1322,14 +1316,14 @@ static int mms_ParsePacket( access_t *p_access,
...
@@ -1322,14 +1316,14 @@ static int mms_ParsePacket( access_t *p_access,
p_sys
->
p_header
=
realloc
(
p_sys
->
p_header
,
p_sys
->
p_header
=
realloc
(
p_sys
->
p_header
,
p_sys
->
i_header
+
i_packet_length
-
8
);
p_sys
->
i_header
+
i_packet_length
-
8
);
memcpy
(
&
p_sys
->
p_header
[
p_sys
->
i_header
],
memcpy
(
&
p_sys
->
p_header
[
p_sys
->
i_header
],
p_packet
,
p_data
+
8
,
i_packet_length
-
8
);
i_packet_length
-
8
);
p_sys
->
i_header
+=
i_packet_length
-
8
;
p_sys
->
i_header
+=
i_packet_length
-
8
;
free
(
p_packet
);
}
}
else
else
{
{
uint8_t
*
p_packet
=
malloc
(
i_packet_length
-
8
);
// don't bother with preheader
memcpy
(
p_packet
,
p_data
+
8
,
i_packet_length
-
8
);
p_sys
->
p_header
=
p_packet
;
p_sys
->
p_header
=
p_packet
;
p_sys
->
i_header
=
i_packet_length
-
8
;
p_sys
->
i_header
=
i_packet_length
-
8
;
}
}
...
@@ -1341,6 +1335,8 @@ static int mms_ParsePacket( access_t *p_access,
...
@@ -1341,6 +1335,8 @@ static int mms_ParsePacket( access_t *p_access,
}
}
else
else
{
{
uint8_t
*
p_packet
=
malloc
(
i_packet_length
-
8
);
// don't bother with preheader
memcpy
(
p_packet
,
p_data
+
8
,
i_packet_length
-
8
);
FREENULL
(
p_sys
->
p_media
);
FREENULL
(
p_sys
->
p_media
);
p_sys
->
p_media
=
p_packet
;
p_sys
->
p_media
=
p_packet
;
p_sys
->
i_media
=
i_packet_length
-
8
;
p_sys
->
i_media
=
i_packet_length
-
8
;
...
...
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