aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-05-12 13:28:04 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-05-12 13:28:04 -0700
commitd9c58961f91d877e760008e2916527b0d56b8826 (patch)
treefcc41ae3f6a37d5aae0dedf0d130e881c30fd050
parent8a95be51023aa63c25ba4f68677c02b1edae9ab5 (diff)
Fix leaks in server_chttp2_test
-rw-r--r--src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c b/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c
index fdd1040d89..a74c1a27eb 100644
--- a/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c
+++ b/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c
@@ -239,6 +239,7 @@ int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr,
gpr_asprintf(&msg, "No address added out of total %d resolved",
resolved->naddrs);
err = GRPC_ERROR_CREATE_REFERENCING(msg, errors, resolved->naddrs);
+ gpr_free(msg);
goto error;
} else if (count != resolved->naddrs) {
char *msg;
@@ -257,6 +258,7 @@ int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr,
}
}
gpr_free(errors);
+ errors = NULL;
grpc_resolved_addresses_destroy(resolved);
/* Register with the server only upon success */
@@ -268,6 +270,12 @@ int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr,
/* Error path: cleanup and return */
error:
GPR_ASSERT(err != GRPC_ERROR_NONE);
+ if (errors != NULL) {
+ for (i = 0; i < resolved->naddrs; i++) {
+ GRPC_ERROR_UNREF(errors[i]);
+ }
+ gpr_free(errors);
+ }
if (resolved) {
grpc_resolved_addresses_destroy(resolved);
}