diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2015-04-07 08:29:34 +0000 |
---|---|---|
committer | <> | 2015-04-13 18:52:43 +0000 |
commit | b2ccf8dd31d1457ae9f0ae270054117179220370 (patch) | |
tree | 4ccd4a16d5e9ef5869630ba624e822665a6e248c /libntp/ntp_intres.c | |
parent | bdab5265fcbf3f472545073a23f8999749a9f2b9 (diff) | |
download | ntp-master.tar.gz |
Imported from /home/lorry/working-area/delta_ntp/ntp-4.2.8p2.tar.gz.HEADntp-4.2.8p2master
Diffstat (limited to 'libntp/ntp_intres.c')
-rw-r--r-- | libntp/ntp_intres.c | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/libntp/ntp_intres.c b/libntp/ntp_intres.c index 2ac70c1..eea88a1 100644 --- a/libntp/ntp_intres.c +++ b/libntp/ntp_intres.c @@ -684,11 +684,11 @@ blocking_getnameinfo( blocking_gni_resp * gni_resp; size_t octets; size_t resp_octets; - char * host; char * service; char * cp; int rc; time_t time_now; + char host[1024]; gni_req = (void *)((char *)req + sizeof(*req)); @@ -699,19 +699,7 @@ blocking_getnameinfo( * large allocations. We only need room for the host * and service names. */ - NTP_REQUIRE(octets < 1024); - -#ifndef HAVE_ALLOCA - host = emalloc(octets); -#else - host = alloca(octets); - if (NULL == host) { - msyslog(LOG_ERR, - "blocking_getnameinfo unable to allocate %lu octets on stack", - (u_long)octets); - exit(1); - } -#endif + NTP_REQUIRE(octets < sizeof(host)); service = host + gni_req->hostoctets; worker_ctx = get_worker_context(c, gni_req->dns_idx); @@ -793,9 +781,6 @@ blocking_getnameinfo( rc = queue_blocking_response(c, resp, resp_octets, req); if (rc) msyslog(LOG_ERR, "blocking_getnameinfo unable to queue response"); -#ifndef HAVE_ALLOCA - free(host); -#endif return rc; } |