resolve: fix memleak
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 26 Jul 2018 08:33:23 +0000 (17:33 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 26 Jul 2018 08:45:34 +0000 (17:45 +0900)
src/resolve/resolved-etc-hosts.c

index 507f68b..0859166 100644 (file)
@@ -79,7 +79,7 @@ static const struct hash_ops etc_hosts_item_ops = {
 };
 
 static int add_item(Manager *m, int family, const union in_addr_union *address, char **names) {
-
+        _cleanup_strv_free_ char **dummy = names;
         EtcHostsItem key = {
                 .family = family,
                 .address = *address,
@@ -125,6 +125,8 @@ static int add_item(Manager *m, int family, const union in_addr_union *address,
                                 free(item);
                                 return log_oom();
                         }
+
+                        dummy = NULL;
                 }
         }