diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-05-18 23:23:17 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-05-18 23:23:17 +0200 |
commit | cab5b05903096e1c9cf5575ccc73f89d15c8db69 (patch) | |
tree | 0900fc3bb29907617f784137ae91fb39948651ac /src/resolve/resolved-dns-server.c | |
parent | 6b7d2e9ea4cdb4cfa1512d37548a1a967623d7f2 (diff) |
resolved: fix crash when shutting down
Reported by Cristian RodrÃguez
http://lists.freedesktop.org/archives/systemd-devel/2015-May/031626.html
Diffstat (limited to 'src/resolve/resolved-dns-server.c')
-rw-r--r-- | src/resolve/resolved-dns-server.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/resolve/resolved-dns-server.c b/src/resolve/resolved-dns-server.c index caf06fe450..9a62a63258 100644 --- a/src/resolve/resolved-dns-server.c +++ b/src/resolve/resolved-dns-server.c @@ -78,23 +78,24 @@ DnsServer* dns_server_free(DnsServer *s) { if (!s) return NULL; - if (s->manager) { + if (s->link) { if (s->type == DNS_SERVER_LINK) LIST_REMOVE(servers, s->link->dns_servers, s); - else if (s->type == DNS_SERVER_SYSTEM) + + if (s->link->current_dns_server == s) + link_set_dns_server(s->link, NULL); + } + + if (s->manager) { + if (s->type == DNS_SERVER_SYSTEM) LIST_REMOVE(servers, s->manager->dns_servers, s); else if (s->type == DNS_SERVER_FALLBACK) LIST_REMOVE(servers, s->manager->fallback_dns_servers, s); - else - assert_not_reached("Unknown server type"); if (s->manager->current_dns_server == s) manager_set_dns_server(s->manager, NULL); } - if (s->link && s->link->current_dns_server == s) - link_set_dns_server(s->link, NULL); - free(s); return NULL; |