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
b673f323
Commit
b673f323
authored
Jul 27, 2010
by
Hugo Beauzée-Luyssen
Committed by
Rémi Duraffort
Jul 29, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec: encoder: Check memory allocations.
Signed-off-by:
Rémi Duraffort
<
ivoire@videolan.org
>
parent
9d99a7ab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
modules/codec/avcodec/encoder.c
modules/codec/avcodec/encoder.c
+20
-0
No files found.
modules/codec/avcodec/encoder.c
View file @
b673f323
...
@@ -757,6 +757,10 @@ int OpenEncoder( vlc_object_t *p_this )
...
@@ -757,6 +757,10 @@ int OpenEncoder( vlc_object_t *p_this )
if
(
p_enc
->
fmt_out
.
i_extra
)
if
(
p_enc
->
fmt_out
.
i_extra
)
{
{
p_enc
->
fmt_out
.
p_extra
=
malloc
(
p_enc
->
fmt_out
.
i_extra
);
p_enc
->
fmt_out
.
p_extra
=
malloc
(
p_enc
->
fmt_out
.
i_extra
);
if
(
p_enc
->
fmt_out
.
p_extra
==
NULL
)
{
goto
error
;
}
memcpy
(
p_enc
->
fmt_out
.
p_extra
,
p_context
->
extradata
,
memcpy
(
p_enc
->
fmt_out
.
p_extra
,
p_context
->
extradata
,
p_enc
->
fmt_out
.
i_extra
);
p_enc
->
fmt_out
.
i_extra
);
}
}
...
@@ -775,6 +779,10 @@ int OpenEncoder( vlc_object_t *p_this )
...
@@ -775,6 +779,10 @@ int OpenEncoder( vlc_object_t *p_this )
p_context
->
frame_size
:
p_context
->
frame_size
:
RAW_AUDIO_FRAME_SIZE
;
RAW_AUDIO_FRAME_SIZE
;
p_sys
->
p_buffer
=
malloc
(
p_sys
->
i_frame_size
*
p_sys
->
i_sample_bytes
);
p_sys
->
p_buffer
=
malloc
(
p_sys
->
i_frame_size
*
p_sys
->
i_sample_bytes
);
if
(
p_sys
->
p_buffer
==
NULL
)
{
goto
error
;
}
p_enc
->
fmt_out
.
audio
.
i_blockalign
=
p_context
->
block_align
;
p_enc
->
fmt_out
.
audio
.
i_blockalign
=
p_context
->
block_align
;
p_enc
->
fmt_out
.
audio
.
i_bitspersample
=
aout_BitsPerSample
(
vlc_fourcc_GetCodec
(
AUDIO_ES
,
p_enc
->
fmt_out
.
i_codec
)
);
p_enc
->
fmt_out
.
audio
.
i_bitspersample
=
aout_BitsPerSample
(
vlc_fourcc_GetCodec
(
AUDIO_ES
,
p_enc
->
fmt_out
.
i_codec
)
);
...
@@ -783,11 +791,21 @@ int OpenEncoder( vlc_object_t *p_this )
...
@@ -783,11 +791,21 @@ int OpenEncoder( vlc_object_t *p_this )
else
else
p_sys
->
i_buffer_out
=
p_sys
->
i_frame_size
*
p_sys
->
i_sample_bytes
;
p_sys
->
i_buffer_out
=
p_sys
->
i_frame_size
*
p_sys
->
i_sample_bytes
;
p_sys
->
p_buffer_out
=
malloc
(
p_sys
->
i_buffer_out
);
p_sys
->
p_buffer_out
=
malloc
(
p_sys
->
i_buffer_out
);
if
(
p_sys
->
p_buffer_out
==
NULL
)
{
goto
error
;
}
}
}
msg_Dbg
(
p_enc
,
"found encoder %s"
,
psz_namecodec
);
msg_Dbg
(
p_enc
,
"found encoder %s"
,
psz_namecodec
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
error:
free
(
p_enc
->
fmt_out
.
p_extra
);
free
(
p_sys
->
p_buffer
);
free
(
p_sys
->
p_buffer_out
);
free
(
p_sys
);
return
VLC_ENOMEM
;
}
}
/****************************************************************************
/****************************************************************************
...
@@ -814,6 +832,8 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
...
@@ -814,6 +832,8 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
if
(
p_sys
->
i_buffer_out
<
FF_MIN_BUFFER_SIZE
)
if
(
p_sys
->
i_buffer_out
<
FF_MIN_BUFFER_SIZE
)
p_sys
->
i_buffer_out
=
FF_MIN_BUFFER_SIZE
;
p_sys
->
i_buffer_out
=
FF_MIN_BUFFER_SIZE
;
p_sys
->
p_buffer_out
=
malloc
(
p_sys
->
i_buffer_out
);
p_sys
->
p_buffer_out
=
malloc
(
p_sys
->
i_buffer_out
);
if
(
p_sys
->
p_buffer_out
==
NULL
)
return
NULL
;
}
}
memset
(
&
frame
,
0
,
sizeof
(
AVFrame
)
);
memset
(
&
frame
,
0
,
sizeof
(
AVFrame
)
);
...
...
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