Fix leak when running b64_encode_fuzzer tests.

pull/21433/head
Ivan Posva 5 years ago committed by GitHub
parent a12a8f0ce2
commit 79c4a2f1d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      test/core/slice/b64_encode_fuzzer.cc

@ -20,6 +20,7 @@
#include <stdint.h> #include <stdint.h>
#include "src/core/lib/slice/b64.h" #include "src/core/lib/slice/b64.h"
#include "include/grpc/support/alloc.h"
bool squelch = true; bool squelch = true;
bool leak_check = 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; if (size < 2) return 0;
const bool url_safe = static_cast<uint8_t>(0x100) < data[0]; const bool url_safe = static_cast<uint8_t>(0x100) < data[0];
const bool multiline = static_cast<uint8_t>(0x100) < data[1]; const bool multiline = static_cast<uint8_t>(0x100) < data[1];
grpc_base64_encode(reinterpret_cast<const char*>(data + 2), size - 2, char* res = grpc_base64_encode(reinterpret_cast<const char*>(data + 2),
url_safe, multiline); size - 2, url_safe, multiline);
gpr_free(res);
return 0; return 0;
} }

Loading…
Cancel
Save