]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: move variable declaration
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 18 Dec 2020 04:00:57 +0000 (13:00 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 18 Dec 2020 04:00:57 +0000 (13:00 +0900)
src/network/networkd-ndisc.c

index 32b8482527921e9a6ee0d2a8b1ad64d72174ac6a..0d21089d5cc5bc4a101f6cfa38b67c7b3a601cf5 100644 (file)
@@ -840,9 +840,9 @@ static int ndisc_router_process_route(Link *link, sd_ndisc_router *rt) {
                 return log_link_error_errno(link, r, "Failed to get gateway address from RA: %m");
 
         if (link_has_ipv6_address(link, &gateway.in6) == 0) {
-                _cleanup_free_ char *buf = NULL;
-
                 if (DEBUG_LOGGING) {
+                        _cleanup_free_ char *buf = NULL;
+
                         (void) in_addr_to_string(AF_INET6, &gateway, &buf);
                         log_link_debug(link, "Advertised route gateway, %s, is local to the link, ignoring route", strnull(buf));
                 }