Clear xd->mi before init_mc_flow_dispenser returns

init_mc_flow_dispenser() sets xd->mi to &mbmi_ptr, where mbmi_ptr is a
local variable. After init_mc_flow_dispenser() returns, &mbmi_ptr will
be an invalid pointer. Reset xd->mi to null before
init_mc_flow_dispenser() returns to avoid accidentally using an invalid
pointer.

History of this code:
https://aomedia-review.googlesource.com/c/aom/+/93224
https://aomedia-review.googlesource.com/c/aom/+/93383
https://aomedia-review.googlesource.com/c/aom/+/97564

Change-Id: Ibbded519e4345592730c73587952b874b1773fd7
diff --git a/av1/encoder/tpl_model.c b/av1/encoder/tpl_model.c
index 69c8b7d..5a2538b 100644
--- a/av1/encoder/tpl_model.c
+++ b/av1/encoder/tpl_model.c
@@ -9,8 +9,9 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#include <stdint.h>
+#include <assert.h>
 #include <float.h>
+#include <stdint.h>
 
 #include "av1/encoder/thirdpass.h"
 #include "config/aom_config.h"
@@ -1314,6 +1315,10 @@
 
   // Initialize x->mbmi_ext when compound predictions are enabled.
   if (cpi->sf.tpl_sf.allow_compound_pred) av1_zero(x->mbmi_ext);
+
+  // Set the pointer to null since mbmi is only allocated inside this function.
+  assert(xd->mi == &mbmi_ptr);
+  xd->mi = NULL;
 }
 
 // This function stores the motion estimation dependencies of all the blocks in