diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2013-08-15 15:27:39 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2013-08-16 12:43:39 +0800 |
commit | ed5737a33ba41d095db5ae42ddfab7fe49500b9c (patch) | |
tree | f90515872806ab2821245432f11020afa479a09a | |
parent | 6505dbd5abb00936c3e53b54f97f8aa628699e59 (diff) | |
download | talos-petitboot-ed5737a33ba41d095db5ae42ddfab7fe49500b9c.tar.gz talos-petitboot-ed5737a33ba41d095db5ae42ddfab7fe49500b9c.zip |
discover/network: free buffers from resolv.conf update
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
-rw-r--r-- | discover/network.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/discover/network.c b/discover/network.c index 8be07aa..4b9e4f1 100644 --- a/discover/network.c +++ b/discover/network.c @@ -441,17 +441,18 @@ static void network_init_dns(struct network *network) memcpy(buf + len, dns_conf, dns_conf_len); len += dns_conf_len; modified = true; - } - if (!modified) - return; + talloc_free(dns_conf); + } - rc = replace_file("/etc/resolv.conf", buf, len); - if (rc) { - pb_log("error replacing resolv.conf: %s\n", strerror(errno)); - return; + if (modified) { + rc = replace_file("/etc/resolv.conf", buf, len); + if (rc) + pb_log("error replacing resolv.conf: %s\n", + strerror(errno)); } + talloc_free(buf); } struct network *network_init(void *ctx, struct waitset *waitset, bool dry_run) |