|
16 | 16 | #include <aws/http/private/h2_frames.h>
|
17 | 17 | #include <aws/http/private/hpack.h>
|
18 | 18 |
|
| 19 | +#include <aws/common/allocator.h> |
19 | 20 | #include <aws/testing/aws_test_harness.h>
|
20 | 21 |
|
21 | 22 | AWS_EXTERN_C_BEGIN
|
22 | 23 |
|
23 |
| -AWS_TEST_ALLOCATOR_INIT(fuzz_h2_frames) |
24 |
| - |
25 | 24 | int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
26 | 25 |
|
27 |
| - struct aws_allocator *allocator = &fuzz_h2_frames_allocator; |
28 |
| - struct memory_test_allocator *alloc_impl = &fuzz_h2_frames_alloc_impl; |
| 26 | + struct aws_allocator *allocator = aws_mem_tracer_new(aws_default_allocator(), AWS_MEMTRACE_BYTES, 0); |
29 | 27 | struct aws_byte_cursor to_decode = aws_byte_cursor_from_array(data, size);
|
30 | 28 |
|
31 |
| - AWS_ZERO_STRUCT(*alloc_impl); |
32 |
| - aws_mutex_init(&alloc_impl->mutex); |
33 |
| - |
34 | 29 | aws_hpack_static_table_init(allocator);
|
35 | 30 |
|
36 | 31 | struct aws_h2_frame_decoder decoder;
|
@@ -108,13 +103,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
108 | 103 | aws_h2_frame_decoder_clean_up(&decoder);
|
109 | 104 | aws_hpack_static_table_clean_up();
|
110 | 105 |
|
111 |
| - ASSERT_UINT_EQUALS( |
112 |
| - alloc_impl->allocated, |
113 |
| - alloc_impl->freed, |
114 |
| - "Memory Leak Detected %d bytes were allocated, " |
115 |
| - "but only %d were freed.", |
116 |
| - alloc_impl->allocated, |
117 |
| - alloc_impl->freed); |
| 106 | + ASSERT_UINT_EQUALS(0, aws_mem_tracer_count(allocator), "Memory Leak Detected"); |
| 107 | + allocator = aws_mem_tracer_destroy(allocator); |
118 | 108 |
|
119 | 109 | return 0;
|
120 | 110 | }
|
|
0 commit comments