]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dns-domain: fix build failure with libidn
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 25 May 2021 19:40:09 +0000 (04:40 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 26 May 2021 01:23:36 +0000 (10:23 +0900)
Follow-up for 319a4f4bc46b230fc660321e99aaac1bc449deea.

Fixes #19723.

src/shared/dns-domain.c

index 216e1a0647173a5fd916d25cb86f7923da60084b..787bb8fec944b013fcfaf4339c20432d486aa011 100644 (file)
@@ -1335,7 +1335,7 @@ int dns_name_apply_idna(const char *name, char **ret) {
         return -EINVAL;
 #elif HAVE_LIBIDN
         _cleanup_free_ char *buf = NULL;
-        size_t n = 0, allocated = 0;
+        size_t n = 0;
         bool first = true;
         int r, q;
 
@@ -1357,7 +1357,7 @@ int dns_name_apply_idna(const char *name, char **ret) {
                 if (q > 0)
                         r = q;
 
-                if (!GREEDY_REALLOC(buf, allocated, n + !first + DNS_LABEL_ESCAPED_MAX))
+                if (!GREEDY_REALLOC(buf, n + !first + DNS_LABEL_ESCAPED_MAX))
                         return -ENOMEM;
 
                 r = dns_label_escape(label, r, buf + n + !first, DNS_LABEL_ESCAPED_MAX);
@@ -1375,7 +1375,7 @@ int dns_name_apply_idna(const char *name, char **ret) {
         if (n > DNS_HOSTNAME_MAX)
                 return -EINVAL;
 
-        if (!GREEDY_REALLOC(buf, allocated, n + 1))
+        if (!GREEDY_REALLOC(buf, n + 1))
                 return -ENOMEM;
 
         buf[n] = 0;