Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-06-04 03:36:30 +0300
committerMichael Niedermayer <michaelni@gmx.at>2015-06-04 03:36:30 +0300
commit52acd22a7debc19d9f4f27ad55bd17f0d84bdb70 (patch)
tree922039cacaba12485b999526a4f2c406a10464fa /libswresample/rematrix.c
parente91debf8f978dc167213a9559bd34a965104a4b5 (diff)
libswresample/rematrix: Check for malloc errors
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample/rematrix.c')
-rw-r--r--libswresample/rematrix.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
index 4569558138..54ebb96b04 100644
--- a/libswresample/rematrix.c
+++ b/libswresample/rematrix.c
@@ -364,6 +364,8 @@ av_cold int swri_rematrix_init(SwrContext *s){
if (s->midbuf.fmt == AV_SAMPLE_FMT_S16P){
s->native_matrix = av_calloc(nb_in * nb_out, sizeof(int));
s->native_one = av_mallocz(sizeof(int));
+ if (!s->native_matrix || !s->native_one)
+ return AVERROR(ENOMEM);
for (i = 0; i < nb_out; i++)
for (j = 0; j < nb_in; j++)
((int*)s->native_matrix)[i * nb_in + j] = lrintf(s->matrix[i][j] * 32768);
@@ -374,6 +376,8 @@ av_cold int swri_rematrix_init(SwrContext *s){
}else if(s->midbuf.fmt == AV_SAMPLE_FMT_FLTP){
s->native_matrix = av_calloc(nb_in * nb_out, sizeof(float));
s->native_one = av_mallocz(sizeof(float));
+ if (!s->native_matrix || !s->native_one)
+ return AVERROR(ENOMEM);
for (i = 0; i < nb_out; i++)
for (j = 0; j < nb_in; j++)
((float*)s->native_matrix)[i * nb_in + j] = s->matrix[i][j];
@@ -384,6 +388,8 @@ av_cold int swri_rematrix_init(SwrContext *s){
}else if(s->midbuf.fmt == AV_SAMPLE_FMT_DBLP){
s->native_matrix = av_calloc(nb_in * nb_out, sizeof(double));
s->native_one = av_mallocz(sizeof(double));
+ if (!s->native_matrix || !s->native_one)
+ return AVERROR(ENOMEM);
for (i = 0; i < nb_out; i++)
for (j = 0; j < nb_in; j++)
((double*)s->native_matrix)[i * nb_in + j] = s->matrix[i][j];
@@ -395,6 +401,8 @@ av_cold int swri_rematrix_init(SwrContext *s){
// Only for dithering currently
// s->native_matrix = av_calloc(nb_in * nb_out, sizeof(double));
s->native_one = av_mallocz(sizeof(int));
+ if (!s->native_one)
+ return AVERROR(ENOMEM);
// for (i = 0; i < nb_out; i++)
// for (j = 0; j < nb_in; j++)
// ((double*)s->native_matrix)[i * nb_in + j] = s->matrix[i][j];