vp9_cyclic_refresh_alloc: correct cleanup on error

previously only the CYCLIC_REFRESH allocation was being freed

Change-Id: I6e1783d077c5ca83c8d62ea9642f1fb03f2e5bf3
This commit is contained in:
James Zern 2016-02-17 12:36:49 -08:00
parent fdc977afc6
commit 7997c68ed4

View File

@ -30,13 +30,13 @@ CYCLIC_REFRESH *vp9_cyclic_refresh_alloc(int mi_rows, int mi_cols) {
cr->map = vpx_calloc(mi_rows * mi_cols, sizeof(*cr->map)); cr->map = vpx_calloc(mi_rows * mi_cols, sizeof(*cr->map));
if (cr->map == NULL) { if (cr->map == NULL) {
vpx_free(cr); vp9_cyclic_refresh_free(cr);
return NULL; return NULL;
} }
last_coded_q_map_size = mi_rows * mi_cols * sizeof(*cr->last_coded_q_map); last_coded_q_map_size = mi_rows * mi_cols * sizeof(*cr->last_coded_q_map);
cr->last_coded_q_map = vpx_malloc(last_coded_q_map_size); cr->last_coded_q_map = vpx_malloc(last_coded_q_map_size);
if (cr->last_coded_q_map == NULL) { if (cr->last_coded_q_map == NULL) {
vpx_free(cr); vp9_cyclic_refresh_free(cr);
return NULL; return NULL;
} }
assert(MAXQ <= 255); assert(MAXQ <= 255);
@ -45,7 +45,7 @@ CYCLIC_REFRESH *vp9_cyclic_refresh_alloc(int mi_rows, int mi_cols) {
consec_zero_mv_size = mi_rows * mi_cols * sizeof(*cr->consec_zero_mv); consec_zero_mv_size = mi_rows * mi_cols * sizeof(*cr->consec_zero_mv);
cr->consec_zero_mv = vpx_malloc(consec_zero_mv_size); cr->consec_zero_mv = vpx_malloc(consec_zero_mv_size);
if (cr->consec_zero_mv == NULL) { if (cr->consec_zero_mv == NULL) {
vpx_free(cr); vp9_cyclic_refresh_free(cr);
return NULL; return NULL;
} }
memset(cr->consec_zero_mv, 0, consec_zero_mv_size); memset(cr->consec_zero_mv, 0, consec_zero_mv_size);