MA-11363 [Android] Don't free memory for boot image in AVB
authorLuo Ji <ji.luo@nxp.com>
Mon, 12 Feb 2018 08:33:49 +0000 (16:33 +0800)
committerzhang sanshan <sanshan.zhang@nxp.com>
Fri, 23 Feb 2018 06:05:28 +0000 (14:05 +0800)
We read the boot image to a fixed partition which is defined
in boot header, this part of memory should not be freed with
free() otherwise "Synchronous Abort" error may happen.

Change-Id: I0fd9a3e558fda90c4daeee3080e4f9b393e11d98
Signed-off-by: Luo Ji <ji.luo@nxp.com>
lib/avb/libavb/avb_slot_verify.c
lib/avb/libavb_ab/avb_ab_flow.c

index 369165e..0cec5cb 100644 (file)
@@ -1413,7 +1413,9 @@ AvbSlotVerifyResult avb_slot_verify(AvbOps* ops,
 
 fail:
   if (slot_data != NULL) {
-    avb_slot_verify_data_free(slot_data);
+    /* the address of bootimage isn't alloced by malloc,
+     * we should not free it. */
+    avb_slot_verify_data_free_fast(slot_data);
   }
   return ret;
 }
index 0ef9255..4d48b73 100644 (file)
@@ -595,7 +595,9 @@ out:
 
   for (n = 0; n < 2; n++) {
     if (slot_data[n] != NULL) {
-      avb_slot_verify_data_free(slot_data[n]);
+      /* the address of bootimage isn't alloced by malloc,
+       * we should not free it. */
+      avb_slot_verify_data_free_fast(slot_data[n]);
     }
   }
 
@@ -603,9 +605,7 @@ out:
     *out_data = data;
   } else {
     if (data != NULL) {
-      /* the address of bootimage isn't alloced by malloc,
-       * we should not free it. */
-      avb_slot_verify_data_free_fast(data);
+      avb_slot_verify_data_free(data);
     }
   }