shithub: libvpx

Download patch

ref: cf8f6559ce1b99df99bcda87a0f4d6ec5e29d571
parent: af631e1f1959cf4961e1abeb7f547d6a9114fbcd
author: James Zern <jzern@google.com>
date: Wed Sep 23 13:55:51 EDT 2015

vp9/10 encoder: prevent NULL access on failure

Change-Id: I1fc8e0b3d48675cd5428b7b36f7cc28ab32cbf71

--- a/vp10/encoder/encoder.c
+++ b/vp10/encoder/encoder.c
@@ -1820,7 +1820,7 @@
   snprintf((H) + strlen(H), sizeof(H) - strlen(H), (T), (V))
 
 void vp10_remove_compressor(VP10_COMP *cpi) {
-  VP10_COMMON *const cm = &cpi->common;
+  VP10_COMMON *cm;
   unsigned int i;
   int t;
 
@@ -1827,7 +1827,8 @@
   if (!cpi)
     return;
 
-  if (cpi && (cm->current_video_frame > 0)) {
+  cm = &cpi->common;
+  if (cm->current_video_frame > 0) {
 #if CONFIG_INTERNAL_STATS
     vpx_clear_system_state();
 
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -1927,7 +1927,7 @@
   snprintf((H) + strlen(H), sizeof(H) - strlen(H), (T), (V))
 
 void vp9_remove_compressor(VP9_COMP *cpi) {
-  VP9_COMMON *const cm = &cpi->common;
+  VP9_COMMON *cm;
   unsigned int i;
   int t;
 
@@ -1934,7 +1934,8 @@
   if (!cpi)
     return;
 
-  if (cpi && (cm->current_video_frame > 0)) {
+  cm = &cpi->common;
+  if (cm->current_video_frame > 0) {
 #if CONFIG_INTERNAL_STATS
     vpx_clear_system_state();