From 6a51af9efe738f303e5813db578d61e3844ffc2f Mon Sep 17 00:00:00 2001 From: Deomid Ryabkov <rojer@cesanta.com> Date: Wed, 27 Jun 2018 09:16:17 +0100 Subject: [PATCH] Fix a bug in mg_mgr_init_opt with opts.num_ifaces h/t @YankunLi Closes https://github.com/cesanta/mongoose/pull/939 CL: mg: Fix a bug in mg_mgr_init_opt with opts.num_ifaces PUBLISHED_FROM=a87518b3505429a3cf9cd6d84b3b781e7dbdcfd5 --- mongoose.c | 2 +- src/mg_net.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mongoose.c b/mongoose.c index 9cb7816c6..a9ea7c8d4 100644 --- a/mongoose.c +++ b/mongoose.c @@ -2514,7 +2514,7 @@ void mg_mgr_init_opt(struct mg_mgr *m, void *user_data, m->num_ifaces = opts.num_ifaces; m->ifaces = (struct mg_iface **) MG_MALLOC(sizeof(*m->ifaces) * opts.num_ifaces); - for (i = 0; i < mg_num_ifaces; i++) { + for (i = 0; i < opts.num_ifaces; i++) { m->ifaces[i] = mg_if_create_iface(opts.ifaces[i], m); m->ifaces[i]->vtable->init(m->ifaces[i]); } diff --git a/src/mg_net.c b/src/mg_net.c index ad9a8fb08..5c9614091 100644 --- a/src/mg_net.c +++ b/src/mg_net.c @@ -224,7 +224,7 @@ void mg_mgr_init_opt(struct mg_mgr *m, void *user_data, m->num_ifaces = opts.num_ifaces; m->ifaces = (struct mg_iface **) MG_MALLOC(sizeof(*m->ifaces) * opts.num_ifaces); - for (i = 0; i < mg_num_ifaces; i++) { + for (i = 0; i < opts.num_ifaces; i++) { m->ifaces[i] = mg_if_create_iface(opts.ifaces[i], m); m->ifaces[i]->vtable->init(m->ifaces[i]); } -- GitLab