diff options
author | Igor Sysoev <igor@sysoev.ru> | 2017-06-20 19:49:17 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2017-06-20 19:49:17 +0300 |
commit | f888a5310c1808902b4035ca3454b62bc5cf4434 (patch) | |
tree | 7425e11cdba27420d21468b0f79787834bd3c498 /src/nxt_job_resolve.c | |
parent | c7ab908c19242a5ddd0233e123e8c2be210b3c02 (diff) | |
download | unit-f888a5310c1808902b4035ca3454b62bc5cf4434.tar.gz unit-f888a5310c1808902b4035ca3454b62bc5cf4434.tar.bz2 |
Using new memory pool implementation.
Diffstat (limited to 'src/nxt_job_resolve.c')
-rw-r--r-- | src/nxt_job_resolve.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/nxt_job_resolve.c b/src/nxt_job_resolve.c index dc508ec3..a1317756 100644 --- a/src/nxt_job_resolve.c +++ b/src/nxt_job_resolve.c @@ -13,8 +13,8 @@ nxt_job_resolve(nxt_job_resolve_t *jbr) int err; u_char *host; size_t length; + nxt_mp_t *mp; nxt_uint_t n; - nxt_mem_pool_t *mp; nxt_sockaddr_t *sa; struct addrinfo hint, *res, *r; nxt_work_handler_t handler; @@ -31,7 +31,7 @@ nxt_job_resolve(nxt_job_resolve_t *jbr) host = buf; } else { - host = nxt_mem_alloc(jbr->job.mem_pool, length); + host = nxt_mp_alloc(jbr->job.mem_pool, length); if (nxt_slow_path(host == NULL)) { goto fail; } @@ -70,7 +70,7 @@ nxt_job_resolve(nxt_job_resolve_t *jbr) jbr->count = n; mp = jbr->job.mem_pool; - jbr->sockaddrs = nxt_mem_alloc(mp, n * sizeof(nxt_sockaddr_t *)); + jbr->sockaddrs = nxt_mp_alloc(mp, n * sizeof(nxt_sockaddr_t *)); if (nxt_slow_path(jbr->sockaddrs == NULL)) { goto fail; } @@ -124,5 +124,9 @@ fail: freeaddrinfo(res); } + if (host != buf) { + nxt_mp_free(jbr->job.mem_pool, host); + } + nxt_job_return(jbr->job.task, &jbr->job, handler); } |