aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext/transport/chttp2/transport/frame_rst_stream.c
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-06-20 08:24:44 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-06-20 08:24:44 -0700
commit78a73333b705a9d184da7f3174533500d05b2a21 (patch)
tree1358e61ca54eb662b6d904674d0419538b3d1170 /src/core/ext/transport/chttp2/transport/frame_rst_stream.c
parent4e29480e430b94392105934750adfd85cb7849ce (diff)
Fix memory leak upon receiving two RST_STREAMs
Diffstat (limited to 'src/core/ext/transport/chttp2/transport/frame_rst_stream.c')
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_rst_stream.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/core/ext/transport/chttp2/transport/frame_rst_stream.c b/src/core/ext/transport/chttp2/transport/frame_rst_stream.c
index a7aefb9915..e3a3c9e4a7 100644
--- a/src/core/ext/transport/chttp2/transport/frame_rst_stream.c
+++ b/src/core/ext/transport/chttp2/transport/frame_rst_stream.c
@@ -102,12 +102,14 @@ grpc_error *grpc_chttp2_rst_stream_parser_parse(
if (p->byte == 4) {
GPR_ASSERT(is_last);
stream_parsing->received_close = 1;
- stream_parsing->forced_close_error = grpc_error_set_int(
- GRPC_ERROR_CREATE("RST_STREAM"), GRPC_ERROR_INT_HTTP2_ERROR,
- (intptr_t)((((uint32_t)p->reason_bytes[0]) << 24) |
- (((uint32_t)p->reason_bytes[1]) << 16) |
- (((uint32_t)p->reason_bytes[2]) << 8) |
- (((uint32_t)p->reason_bytes[3]))));
+ if (stream_parsing->forced_close_error == GRPC_ERROR_NONE) {
+ stream_parsing->forced_close_error = grpc_error_set_int(
+ GRPC_ERROR_CREATE("RST_STREAM"), GRPC_ERROR_INT_HTTP2_ERROR,
+ (intptr_t)((((uint32_t)p->reason_bytes[0]) << 24) |
+ (((uint32_t)p->reason_bytes[1]) << 16) |
+ (((uint32_t)p->reason_bytes[2]) << 8) |
+ (((uint32_t)p->reason_bytes[3]))));
+ }
}
return GRPC_ERROR_NONE;