]> granicus.if.org Git - libvpx/commitdiff
vp9_pickmode.c: check value that can be null to avoid warning
authorJim Bankoski <jimbankoski@google.com>
Mon, 18 Aug 2014 22:41:58 +0000 (15:41 -0700)
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>
Tue, 19 Aug 2014 13:16:34 +0000 (06:16 -0700)
Change-Id: Ia023a49ddb606899171ff19f9e271ec8ed0b2fb3

vp9/encoder/vp9_pickmode.c

index 6115f5a0f1dd9e83effb9c65d48bacb64c1c62c5..cf96e292081181b1c8bb12a99f8a87dbcf26cfc3 100644 (file)
@@ -253,7 +253,8 @@ static int get_pred_buffer(PRED_BUFFER *p, int len) {
 }
 
 static void free_pred_buffer(PRED_BUFFER *p) {
-  p->in_use = 0;
+  if (p != NULL)
+    p->in_use = 0;
 }
 
 static void encode_breakout_test(VP9_COMP *cpi, MACROBLOCK *x,
@@ -625,8 +626,7 @@ int64_t vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
         skip_txfm = x->skip_txfm[0];
 
         if (cpi->sf.reuse_inter_pred_sby) {
-          if (best_pred != NULL)
-            free_pred_buffer(best_pred);
+          free_pred_buffer(best_pred);
 
           best_pred = this_mode_pred;
         }
@@ -646,7 +646,8 @@ int64_t vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
 
   // If best prediction is not in dst buf, then copy the prediction block from
   // temp buf to dst buf.
-  if (cpi->sf.reuse_inter_pred_sby && best_pred->data != orig_dst.buf) {
+  if (best_pred != NULL && cpi->sf.reuse_inter_pred_sby &&
+      best_pred->data != orig_dst.buf) {
     uint8_t *copy_from, *copy_to;
 
     pd->dst = orig_dst;