dns: reuse global name_buffer in dns_send_question()
authorFelix Fietkau <nbd@openwrt.org>
Tue, 3 Jun 2014 21:12:59 +0000 (23:12 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 3 Jun 2014 21:12:59 +0000 (23:12 +0200)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
dns.c

diff --git a/dns.c b/dns.c
index 6389f8cc15e4ae64d5a5aae557fc2535001bc283..5595384a544b0f86ba326629defd27a47c2a3b27 100644 (file)
--- 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;