Browse Source

fix a potential dangling pointer

pull/14/merge
Max Lv 11 years ago
parent
commit
5cc6b22736
1 changed files with 9 additions and 9 deletions
  1. 18
      src/server.c

18
src/server.c

@ -872,15 +872,15 @@ int main (int argc, char **argv) {
LOGD("server listening at port %s.", server_port);
// Setup proxy context
struct listen_ctx listen_ctx;
listen_ctx.timeout = atoi(timeout);
listen_ctx.asyncns = asyncns;
listen_ctx.fd = listenfd;
listen_ctx.method = m;
listen_ctx.iface = iface;
ev_io_init (&listen_ctx.io, accept_cb, listenfd, EV_READ);
ev_io_start (loop, &listen_ctx.io);
struct listen_ctx *listen_ctx = malloc(sizeof(struct listen_ctx));
listen_ctx->timeout = atoi(timeout);
listen_ctx->asyncns = asyncns;
listen_ctx->fd = listenfd;
listen_ctx->method = m;
listen_ctx->iface = iface;
ev_io_init (&listen_ctx->io, accept_cb, listenfd, EV_READ);
ev_io_start (loop, &listen_ctx->io);
}
// start ev loop

Loading…
Cancel
Save