Commit dadc43ee authored by Michael Niedermayer's avatar Michael Niedermayer

avutil/pca: Check for av_malloc* failures

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 4a108116
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment