summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-04-21 09:38:26 +0200
committerThomas Haller <thaller@redhat.com>2016-04-21 15:32:07 +0200
commitde9ad6bd8cd032a370f7795334ee8dd77a5fcd8d (patch)
tree615c2bcc6ac28288caaf8e2285e8265dda7a062a
parenta6477fca486b756653c4fd0ee1adca6c628d6656 (diff)
downloadNetworkManager-de9ad6bd8cd032a370f7795334ee8dd77a5fcd8d.tar.gz
dns: minor code cleanup in NMDnsPlugin
-rw-r--r--src/dns-manager/nm-dns-plugin.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/dns-manager/nm-dns-plugin.c b/src/dns-manager/nm-dns-plugin.c
index 47322d2ae2..850bd9a3e3 100644
--- a/src/dns-manager/nm-dns-plugin.c
+++ b/src/dns-manager/nm-dns-plugin.c
@@ -96,8 +96,7 @@ _clear_pidfile (NMDnsPlugin *self)
if (priv->pidfile) {
unlink (priv->pidfile);
- g_free (priv->pidfile);
- priv->pidfile = NULL;
+ g_clear_pointer (&priv->pidfile, g_free);
}
}
@@ -154,8 +153,8 @@ watch_cb (GPid pid, gint status, gpointer user_data)
priv->pid = 0;
priv->watch_id = 0;
- g_free (priv->progname);
- priv->progname = NULL;
+
+ g_clear_pointer (&priv->progname, g_free);
_clear_pidfile (self);
@@ -172,8 +171,7 @@ nm_dns_plugin_child_spawn (NMDnsPlugin *self,
GError *error = NULL;
char *cmdline;
- g_return_val_if_fail (argv != NULL, 0);
- g_return_val_if_fail (argv[0] != NULL, 0);
+ g_return_val_if_fail (argv && argv[0], 0);
g_warn_if_fail (priv->progname == NULL);
g_free (priv->progname);
@@ -217,8 +215,7 @@ nm_dns_plugin_child_kill (NMDnsPlugin *self)
if (priv->pid) {
nm_utils_kill_child_sync (priv->pid, SIGTERM, LOGD_DNS, priv->progname, NULL, 1000, 0);
priv->pid = 0;
- g_free (priv->progname);
- priv->progname = NULL;
+ g_clear_pointer (&priv->progname, g_free);
}
_clear_pidfile (self);