From 79c4a2f1d80c831d4b81e4cd9227737dc210576d Mon Sep 17 00:00:00 2001 From: Ivan Posva Date: Mon, 9 Dec 2019 22:33:19 -0800 Subject: [PATCH] Fix leak when running b64_encode_fuzzer tests. --- test/core/slice/b64_encode_fuzzer.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/core/slice/b64_encode_fuzzer.cc b/test/core/slice/b64_encode_fuzzer.cc index bc4f4a9bf55..f5161ee09ae 100644 --- a/test/core/slice/b64_encode_fuzzer.cc +++ b/test/core/slice/b64_encode_fuzzer.cc @@ -20,6 +20,7 @@ #include #include "src/core/lib/slice/b64.h" +#include "include/grpc/support/alloc.h" bool squelch = true; bool leak_check = true; @@ -28,7 +29,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (size < 2) return 0; const bool url_safe = static_cast(0x100) < data[0]; const bool multiline = static_cast(0x100) < data[1]; - grpc_base64_encode(reinterpret_cast(data + 2), size - 2, - url_safe, multiline); + char* res = grpc_base64_encode(reinterpret_cast(data + 2), + size - 2, url_safe, multiline); + gpr_free(res); return 0; }