[FFmpeg-cvslog] avutil/pca: Check for av_malloc* failures
Michael Niedermayer
git at videolan.org
Sat Apr 25 17:04:46 CEST 2015
ffmpeg | branch: release/2.4 | Michael Niedermayer <michaelni at gmx.at> | Mon Mar 30 04:37:42 2015 +0200| [3fd66f7f4589dbc31d144454546506a0bb939647] | committer: Michael Niedermayer
avutil/pca: Check for av_malloc* failures
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit dadc43eee4d9036aa532665a04720238cc15e922)
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3fd66f7f4589dbc31d144454546506a0bb939647
---
libavutil/pca.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libavutil/pca.c b/libavutil/pca.c
index 26d5bbb..86cb37e 100644
--- a/libavutil/pca.c
+++ b/libavutil/pca.c
@@ -41,12 +41,20 @@ PCA *ff_pca_init(int n){
return NULL;
pca= av_mallocz(sizeof(*pca));
+ if (!pca)
+ return NULL;
+
pca->n= n;
pca->z = av_malloc_array(n, sizeof(*pca->z));
pca->count=0;
pca->covariance= av_calloc(n*n, sizeof(double));
pca->mean= av_calloc(n, sizeof(double));
+ if (!pca->z || !pca->covariance || !pca->mean) {
+ ff_pca_free(pca);
+ return NULL;
+ }
+
return pca;
}
More information about the ffmpeg-cvslog
mailing list