Encoder: Fix memory uninitialized issue in the encoder

Test: atest android.mediav2.cts.CodecEncoderTest
Test: atest VtsHalMediaC2V1_0TargetVideoEncTest
Bug: 193442575

Change-Id: I75475d3bb822fa0e0493ecc2d67c7da26a907d19
(cherry picked from commit c9d7c5cda489548e7de9aafc3c6eef5b2ce61153)
diff --git a/encoder/ih264e_api.c b/encoder/ih264e_api.c
index 53067e0..1f69e3e 100644
--- a/encoder/ih264e_api.c
+++ b/encoder/ih264e_api.c
@@ -4132,6 +4132,13 @@
 
     /* mem records */
     ps_mem_rec_base = ps_ip->s_ive_ip.ps_mem_rec;
+    /* memset all allocated memory, except the first one. First buffer (i.e. i == MEM_REC_IV_OBJ)
+       is initialized by application before calling this init function */
+    for (i = MEM_REC_CODEC; i < MEM_REC_CNT; i++)
+    {
+        ps_mem_rec = &ps_mem_rec_base[i];
+        memset(ps_mem_rec->pv_base, 0, ps_mem_rec->u4_mem_size);
+    }
 
     /* Init mem records */
     ps_mem_rec = &ps_mem_rec_base[MEM_REC_CODEC];