From a592ffa7451e67d453e42e4f79bc5e7cb498e2b3 Mon Sep 17 00:00:00 2001
From: "Nicolas \"Pixel\" Noble" <pixel@nobis-crew.org>
Date: Tue, 12 Apr 2016 19:56:57 +0200
Subject: [PATCH] Memory checking the client fuzzer.

---
 test/core/end2end/fuzzers/client_fuzzer.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/test/core/end2end/fuzzers/client_fuzzer.c b/test/core/end2end/fuzzers/client_fuzzer.c
index 4e22e268f0..afcf7638f7 100644
--- a/test/core/end2end/fuzzers/client_fuzzer.c
+++ b/test/core/end2end/fuzzers/client_fuzzer.c
@@ -36,6 +36,7 @@
 
 #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
 #include "src/core/lib/surface/channel.h"
+#include "test/core/util/memory_counters.h"
 #include "test/core/util/mock_endpoint.h"
 
 static const bool squelch = true;
@@ -48,7 +49,9 @@ static void dont_log(gpr_log_func_args *args) {}
 
 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   grpc_test_only_set_metadata_hash_seed(0);
+  struct grpc_memory_counters counters;
   if (squelch) gpr_set_log_function(dont_log);
+  grpc_memory_counters_init();
   grpc_init();
   grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
 
@@ -150,5 +153,8 @@ done:
     grpc_byte_buffer_destroy(response_payload_recv);
   }
   grpc_shutdown();
+  counters = grpc_memory_counters_snapshot();
+  grpc_memory_counters_destroy();
+  GPR_ASSERT(counters.total_size_relative == 0);
   return 0;
 }
-- 
GitLab