From 895f14d38176bca1a4146e9d0fb6d80f40647545 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 10 Nov 2015 09:30:39 +0000 Subject: [PATCH] Fix memory leak --- src/core/transport/chttp2/hpack_parser.c | 1 - src/core/transport/chttp2/hpack_table.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/core/transport/chttp2/hpack_parser.c b/src/core/transport/chttp2/hpack_parser.c index 6d3c340a8af..0f90f08b9cc 100644 --- a/src/core/transport/chttp2/hpack_parser.c +++ b/src/core/transport/chttp2/hpack_parser.c @@ -627,7 +627,6 @@ static const gpr_uint8 inverse_base64[256] = { static int on_hdr(grpc_chttp2_hpack_parser *p, grpc_mdelem *md, int add_to_table) { if (add_to_table) { - GRPC_MDELEM_REF(md); if (!grpc_chttp2_hptbl_add(&p->table, md)) { return 0; } diff --git a/src/core/transport/chttp2/hpack_table.c b/src/core/transport/chttp2/hpack_table.c index e47793f2300..e7cec99be1b 100644 --- a/src/core/transport/chttp2/hpack_table.c +++ b/src/core/transport/chttp2/hpack_table.c @@ -316,7 +316,7 @@ int grpc_chttp2_hptbl_add(grpc_chttp2_hptbl *tbl, grpc_mdelem *md) { } /* copy the finalized entry in */ - tbl->ents[tbl->last_ent] = md; + tbl->ents[tbl->last_ent] = GRPC_MDELEM_REF(md); /* update accounting values */ tbl->last_ent =