diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp
index 1958ba184c21a347d2d20d5b603d6f536cbbacb8..3548d84c32f5d26d8ee8a594bd13f0ac08f27c68 100644
--- a/source/Lib/DecoderLib/CABACReader.cpp
+++ b/source/Lib/DecoderLib/CABACReader.cpp
@@ -1567,10 +1567,10 @@ void CABACReader::MHIntra_luma_pred_modes(CodingUnit &cu)
     }
   }
 
+  unsigned mpm_pred[numMPMs];
   // mpm_idx / rem_intra_luma_pred_mode
   for (int k = 0; k < numBlocks; k++)
   {
-    unsigned *mpm_pred = (unsigned*)alloca(numMPMs * sizeof(unsigned));
     PU::getMHIntraMPMs(*pu, mpm_pred);
 
     if (mpmFlag[k])
diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp
index f1c044e9ca02f5a42255c530ff7867ee8c91510f..1bec156f2d56b839ff9925b399a89fd92e618224 100644
--- a/source/Lib/EncoderLib/CABACWriter.cpp
+++ b/source/Lib/EncoderLib/CABACWriter.cpp
@@ -1478,21 +1478,19 @@ void CABACWriter::MHIntra_luma_pred_modes(const CodingUnit& cu)
     return;
   }
 
-  unsigned numMPMs = 3;
+  const unsigned numMPMs = 3;
   int      numBlocks = CU::getNumPUs(cu);
-  unsigned *mpm_preds[4];
   unsigned mpm_idxs[4];
   unsigned pred_modes[4];
 
   const PredictionUnit* pu = cu.firstPU;
 
+  unsigned mpm_pred[numMPMs];
   for (int k = 0; k < numBlocks; k++)
   {
-    unsigned*& mpm_pred = mpm_preds[k];
     unsigned&  mpm_idx = mpm_idxs[k];
     unsigned&  pred_mode = pred_modes[k];
 
-    mpm_pred = (unsigned*)alloca(numMPMs * sizeof(unsigned));
     PU::getMHIntraMPMs(*pu, mpm_pred);
 
     pred_mode = pu->intraDir[0];