Commit 21b93364d777cbf409139d14eb3e341e2ac1ec33

Authored by Luo Ji
Committed by zhang sanshan
1 parent 8e339df8eb

MA-11363 [Android] Don't free memory for boot image in AVB

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>

Showing 2 changed files with 7 additions and 5 deletions Side-by-side Diff

lib/avb/libavb/avb_slot_verify.c
... ... @@ -1413,7 +1413,9 @@
1413 1413  
1414 1414 fail:
1415 1415 if (slot_data != NULL) {
1416   - avb_slot_verify_data_free(slot_data);
  1416 + /* the address of bootimage isn't alloced by malloc,
  1417 + * we should not free it. */
  1418 + avb_slot_verify_data_free_fast(slot_data);
1417 1419 }
1418 1420 return ret;
1419 1421 }
lib/avb/libavb_ab/avb_ab_flow.c
... ... @@ -595,7 +595,9 @@
595 595  
596 596 for (n = 0; n < 2; n++) {
597 597 if (slot_data[n] != NULL) {
598   - avb_slot_verify_data_free(slot_data[n]);
  598 + /* the address of bootimage isn't alloced by malloc,
  599 + * we should not free it. */
  600 + avb_slot_verify_data_free_fast(slot_data[n]);
599 601 }
600 602 }
601 603  
... ... @@ -603,9 +605,7 @@
603 605 *out_data = data;
604 606 } else {
605 607 if (data != NULL) {
606   - /* the address of bootimage isn't alloced by malloc,
607   - * we should not free it. */
608   - avb_slot_verify_data_free_fast(data);
  608 + avb_slot_verify_data_free(data);
609 609 }
610 610 }
611 611