Fix memory leak

pull/3423/head^2
Craig Tiller 9 years ago
parent fc193e1ff4
commit 7db24e06e2
  1. 2
      src/core/iomgr/udp_server.c

@ -294,6 +294,7 @@ static int add_socket_to_server(grpc_udp_server *s, int fd,
if (port >= 0) { if (port >= 0) {
grpc_sockaddr_to_string(&addr_str, (struct sockaddr *)&addr, 1); grpc_sockaddr_to_string(&addr_str, (struct sockaddr *)&addr, 1);
gpr_asprintf(&name, "udp-server-listener:%s", addr_str); gpr_asprintf(&name, "udp-server-listener:%s", addr_str);
gpr_free(addr_str);
gpr_mu_lock(&s->mu); gpr_mu_lock(&s->mu);
/* append it to the list under a lock */ /* append it to the list under a lock */
if (s->nports == s->port_capacity) { if (s->nports == s->port_capacity) {
@ -309,6 +310,7 @@ static int add_socket_to_server(grpc_udp_server *s, int fd,
sp->read_cb = read_cb; sp->read_cb = read_cb;
GPR_ASSERT(sp->emfd); GPR_ASSERT(sp->emfd);
gpr_mu_unlock(&s->mu); gpr_mu_unlock(&s->mu);
gpr_free(name);
} }
return port; return port;

Loading…
Cancel
Save