From 2ef1a8ff170ea2c81b3523283dfbc1567297a839 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 3 Jun 2014 23:12:59 +0200 Subject: [PATCH] dns: reuse global name_buffer in dns_send_question() Signed-off-by: Felix Fietkau --- dns.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dns.c b/dns.c index 6389f8c..5595384 100644 --- a/dns.c +++ b/dns.c @@ -69,7 +69,6 @@ void dns_send_question(struct uloop_fd *u, char *question, int type) { static size_t cmsg_data[( CMSG_SPACE(sizeof(struct in_pktinfo)) / sizeof(size_t)) + 1]; - static unsigned char buffer[MAX_NAME_LEN]; static struct dns_header h = { .questions = cpu_to_be16(1), }; @@ -82,7 +81,7 @@ dns_send_question(struct uloop_fd *u, char *question, int type) .iov_len = sizeof(h), }, { - .iov_base = buffer, + .iov_base = name_buffer, }, { .iov_base = &q, @@ -108,7 +107,7 @@ dns_send_question(struct uloop_fd *u, char *question, int type) a.sin_addr.s_addr = inet_addr(MCAST_ADDR); q.type = __cpu_to_be16(type); - len = dn_comp(question, buffer, MAX_NAME_LEN, NULL, NULL); + len = dn_comp(question, (void *) name_buffer, sizeof(name_buffer), NULL, NULL); if (len < 1) return; -- 2.11.0