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
db4be852
Commit
db4be852
authored
Mar 05, 2005
by
Gildas Bazin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* src/input/stream.c: check return value of malloc/realloc.
parent
575bd936
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
14 deletions
+18
-14
src/input/input.c
src/input/input.c
+1
-2
src/input/stream.c
src/input/stream.c
+17
-12
No files found.
src/input/input.c
View file @
db4be852
...
...
@@ -2521,8 +2521,7 @@ int vlc_input_item_AddInfo( input_item_t *p_i,
}
if
(
!
p_cat
)
{
if
(
(
p_cat
=
(
info_category_t
*
)
malloc
(
sizeof
(
info_category_t
)
)
)
==
NULL
)
if
(
!
(
p_cat
=
(
info_category_t
*
)
malloc
(
sizeof
(
info_category_t
)
))
)
{
vlc_mutex_unlock
(
&
p_i
->
lock
);
return
VLC_EGENERIC
;
...
...
src/input/stream.c
View file @
db4be852
...
...
@@ -662,10 +662,13 @@ static int AStreamPeekBlock( stream_t *s, uint8_t **pp_peek, int i_read )
/* We need to create a local copy */
if
(
p_sys
->
i_peek
<
i_read
)
{
if
(
p_sys
->
p_peek
)
free
(
p_sys
->
p_peek
);
p_sys
->
p_peek
=
realloc
(
p_sys
->
p_peek
,
i_read
);
if
(
!
p_sys
->
p_peek
)
{
p_sys
->
i_peek
=
0
;
return
0
;
}
p_sys
->
i_peek
=
i_read
;
p_sys
->
p_peek
=
malloc
(
p_sys
->
i_peek
);
}
/* Fill enough data */
...
...
@@ -674,12 +677,10 @@ static int AStreamPeekBlock( stream_t *s, uint8_t **pp_peek, int i_read )
{
block_t
**
pp_last
=
p_sys
->
block
.
pp_last
;
if
(
AStreamRefillBlock
(
s
)
)
break
;
if
(
AStreamRefillBlock
(
s
)
)
break
;
/* Our buffer are probably filled enough, don't try anymore */
if
(
pp_last
==
p_sys
->
block
.
pp_last
)
break
;
if
(
pp_last
==
p_sys
->
block
.
pp_last
)
break
;
}
/* Copy what we have */
...
...
@@ -1000,10 +1001,10 @@ static int AStreamPeekStream( stream_t *s, uint8_t **pp_peek, int i_read )
if
(
p_sys
->
stream
.
i_used
<=
1
)
{
/* Be sure we will read something */
p_sys
->
stream
.
i_used
+=
i_read
-
(
tk
->
i_end
-
tk
->
i_start
-
p_sys
->
stream
.
i_offset
);
p_sys
->
stream
.
i_used
+=
i_read
-
(
tk
->
i_end
-
tk
->
i_start
-
p_sys
->
stream
.
i_offset
);
}
if
(
AStreamRefillStream
(
s
)
)
break
;
if
(
AStreamRefillStream
(
s
)
)
break
;
}
if
(
tk
->
i_end
-
tk
->
i_start
-
p_sys
->
stream
.
i_offset
<
i_read
)
...
...
@@ -1019,9 +1020,13 @@ static int AStreamPeekStream( stream_t *s, uint8_t **pp_peek, int i_read )
if
(
p_sys
->
i_peek
<
i_read
)
{
if
(
p_sys
->
p_peek
)
free
(
p_sys
->
p_peek
);
p_sys
->
p_peek
=
realloc
(
p_sys
->
p_peek
,
i_read
);
if
(
!
p_sys
->
p_peek
)
{
p_sys
->
i_peek
=
0
;
return
0
;
}
p_sys
->
i_peek
=
i_read
;
p_sys
->
p_peek
=
malloc
(
i_read
);
}
memcpy
(
p_sys
->
p_peek
,
&
tk
->
p_buffer
[
i_off
],
...
...
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