aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-12-07 15:23:21 -0800
committerGravatar Craig Tiller <ctiller@google.com>2016-12-07 15:23:21 -0800
commit75731e65a8454d2632acd84a9255facaacc3d424 (patch)
treedf5ce66800c6825e8c0830dfff65322827001302 /test
parentebc77551e90793e1cd5403cb740c70b13403ecfd (diff)
Fix some leaks/use-after-frees
Diffstat (limited to 'test')
-rw-r--r--test/core/end2end/fixtures/proxy.c4
-rw-r--r--test/core/end2end/invalid_call_argument_test.c1
-rw-r--r--test/core/end2end/tests/max_concurrent_streams.c2
-rw-r--r--test/core/transport/chttp2/hpack_encoder_test.c14
4 files changed, 15 insertions, 6 deletions
diff --git a/test/core/end2end/fixtures/proxy.c b/test/core/end2end/fixtures/proxy.c
index c592f5a471..30bb9ff1b3 100644
--- a/test/core/end2end/fixtures/proxy.c
+++ b/test/core/end2end/fixtures/proxy.c
@@ -111,6 +111,7 @@ grpc_end2end_proxy *grpc_end2end_proxy_create(const grpc_end2end_proxy_def *def,
grpc_server_register_completion_queue(proxy->server, proxy->cq, NULL);
grpc_server_start(proxy->server);
+ grpc_call_details_init(&proxy->new_call_details);
gpr_thd_options_set_joinable(&opt);
GPR_ASSERT(gpr_thd_new(&proxy->thd, thread_main, proxy, &opt));
@@ -398,6 +399,9 @@ static void on_new_call(void *arg, int success) {
request_call(proxy);
+ grpc_call_details_destroy(&proxy->new_call_details);
+ grpc_call_details_init(&proxy->new_call_details);
+
unrefpc(pc, "init");
} else {
GPR_ASSERT(proxy->new_call == NULL);
diff --git a/test/core/end2end/invalid_call_argument_test.c b/test/core/end2end/invalid_call_argument_test.c
index 3b26ddb6d0..3a68e55ba3 100644
--- a/test/core/end2end/invalid_call_argument_test.c
+++ b/test/core/end2end/invalid_call_argument_test.c
@@ -75,6 +75,7 @@ static void prepare_test(int is_client) {
g_state.deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(2);
g_state.cq = grpc_completion_queue_create(NULL);
g_state.cqv = cq_verifier_create(g_state.cq);
+ g_state.details = grpc_empty_slice();
memset(g_state.ops, 0, sizeof(g_state.ops));
if (is_client) {
diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c
index 56243179b0..b34ea40f1b 100644
--- a/test/core/end2end/tests/max_concurrent_streams.c
+++ b/test/core/end2end/tests/max_concurrent_streams.c
@@ -391,6 +391,8 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
CQ_EXPECT_COMPLETION(cqv, tag(live_call + 1), 1);
cq_verify(cqv);
+ grpc_call_details_destroy(&call_details);
+
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
f.server, &s2, &call_details,
&request_metadata_recv, f.cq, f.cq, tag(201)));
diff --git a/test/core/transport/chttp2/hpack_encoder_test.c b/test/core/transport/chttp2/hpack_encoder_test.c
index 9e418bad5d..d572d79a7f 100644
--- a/test/core/transport/chttp2/hpack_encoder_test.c
+++ b/test/core/transport/chttp2/hpack_encoder_test.c
@@ -81,9 +81,9 @@ static void verify(grpc_exec_ctx *exec_ctx, size_t window_available, int eof,
e[i - 1].next = &e[i];
e[i].prev = &e[i - 1];
}
- e[i].md =
- grpc_mdelem_from_slices(exec_ctx, grpc_slice_from_copied_string(key),
- grpc_slice_from_copied_string(value));
+ e[i].md = grpc_mdelem_from_slices(
+ exec_ctx, grpc_slice_intern(grpc_slice_from_static_string(key)),
+ grpc_slice_intern(grpc_slice_from_static_string(value)));
}
e[0].prev = NULL;
e[nheaders - 1].next = NULL;
@@ -91,6 +91,7 @@ static void verify(grpc_exec_ctx *exec_ctx, size_t window_available, int eof,
b.list.head = &e[0];
b.list.tail = &e[nheaders - 1];
+ b.list.count = nheaders;
if (cap_to_delete == num_to_delete) {
cap_to_delete = GPR_MAX(2 * cap_to_delete, 1000);
@@ -195,9 +196,9 @@ static void verify_table_size_change_match_elem_size(grpc_exec_ctx *exec_ctx,
const char *key,
const char *value) {
grpc_slice_buffer output;
- grpc_mdelem elem =
- grpc_mdelem_from_slices(exec_ctx, grpc_slice_from_copied_string(key),
- grpc_slice_from_copied_string(value));
+ grpc_mdelem elem = grpc_mdelem_from_slices(
+ exec_ctx, grpc_slice_intern(grpc_slice_from_static_string(key)),
+ grpc_slice_intern(grpc_slice_from_static_string(value)));
size_t elem_size = grpc_mdelem_get_size_in_hpack_table(elem);
size_t initial_table_size = g_compressor.table_size;
grpc_linked_mdelem *e = gpr_malloc(sizeof(*e));
@@ -208,6 +209,7 @@ static void verify_table_size_change_match_elem_size(grpc_exec_ctx *exec_ctx,
e[0].next = NULL;
b.list.head = &e[0];
b.list.tail = &e[0];
+ b.list.count = 1;
grpc_slice_buffer_init(&output);
grpc_transport_one_way_stats stats;