Skip to content

Commit

Permalink
Replace some error and quit with cr_fatal
Browse files Browse the repository at this point in the history
  • Loading branch information
sim-immunant committed Oct 16, 2023
1 parent 40f076b commit 3fe7a35
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions rewriter/tests/heap_two_keys/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ Test(heap_two_keys, 0, .init = trigger_compartment_init) {
Test(heap_two_keys, 1, .init = trigger_compartment_init) {
uint32_t *x = (uint32_t *)malloc(sizeof(uint32_t));
if (!x) {
cr_log_error("Failed to allocate memory on the heap");
exit(EXIT_FAILURE);
cr_fatal("Failed to allocate memory on the heap");
}
*x = 0x09431233;
read_from_plugin_expect_fault((uint8_t*)x);
Expand All @@ -40,8 +39,7 @@ Test(heap_two_keys, 2, .init = trigger_compartment_init) {
// This zeroes out the allocated memory
uint8_t *x = (uint8_t *)calloc(sizeof(uint8_t), 12);
if (!x) {
cr_log_error("Failed to allocate memory on the heap");
exit(EXIT_FAILURE);
cr_fatal("Failed to allocate memory on the heap");
}
write_from_plugin_expect_fault(x, 12);
free(x);
Expand All @@ -53,8 +51,7 @@ Test(heap_two_keys, 2, .init = trigger_compartment_init) {
Test(heap_two_keys, 3, .init = trigger_compartment_init) {
uint16_t *x = (uint16_t *)shared_malloc(sizeof(uint16_t));
if (!x) {
cr_log_error("Failed to allocate memory on the heap");
exit(EXIT_FAILURE);
cr_fatal("Failed to allocate memory on the heap");
}
*x = 0xffed;
assert(read_from_plugin((uint8_t*)x) == 0xed);
Expand Down

0 comments on commit 3fe7a35

Please sign in to comment.