ref: 9caf90425b741d80ad46ff0eb84fda79fc3990e6
parent: 1add94bf0bc54880427f2a37f092749dda9e72f6
author: Derek Buitenhuis <[email protected]>
date: Tue Oct 2 09:25:42 EDT 2018
ref_mvs: Check for alloation fail before calling memset in av1_alloc_ref_mv_common Signed-off-by: Derek Buitenhuis <[email protected]>
--- a/src/lib.c
+++ b/src/lib.c
@@ -121,6 +121,7 @@
}
}
f->libaom_cm = av1_alloc_ref_mv_common();
+ if (!f->libaom_cm) goto error;
if (c->n_fc > 1) {
pthread_mutex_init(&f->frame_thread.td.lock, NULL);
pthread_cond_init(&f->frame_thread.td.cond, NULL);
--- a/src/ref_mvs.c
+++ b/src/ref_mvs.c
@@ -3540,6 +3540,7 @@
AV1_COMMON *av1_alloc_ref_mv_common(void) {
AV1_COMMON *cm = malloc(sizeof(*cm));
+ if (!cm) return NULL;
memset(cm, 0, sizeof(*cm));
return cm;
}