aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/zed/zed_conf.c
diff options
context:
space:
mode:
authorChris Dunlap <[email protected]>2014-10-01 14:56:52 -0700
committerBrian Behlendorf <[email protected]>2014-10-06 13:18:11 -0700
commit8ac9b5e6b5b59ad3bf7a65f9de3c8ed46ba4240e (patch)
tree48a7f9af047864905a22afd881722e60374be8f8 /cmd/zed/zed_conf.c
parent56697c42646f002c4f52f9569a8cb75b45f704d8 (diff)
Cleanup struct zed_conf vars in zed_conf_destroy
Reset struct zed_conf file descriptors to -1 after close(), and pointers to NULL after free(). Signed-off-by: Chris Dunlap <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #2756
Diffstat (limited to 'cmd/zed/zed_conf.c')
-rw-r--r--cmd/zed/zed_conf.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/cmd/zed/zed_conf.c b/cmd/zed/zed_conf.c
index 3f38945c0..638f728e1 100644
--- a/cmd/zed/zed_conf.c
+++ b/cmd/zed/zed_conf.c
@@ -99,6 +99,7 @@ zed_conf_destroy(struct zed_conf *zcp)
zed_log_msg(LOG_WARNING,
"Failed to close state file \"%s\": %s",
zcp->state_file, strerror(errno));
+ zcp->state_fd = -1;
}
if (zcp->pid_file) {
if ((unlink(zcp->pid_file) < 0) && (errno != ENOENT))
@@ -113,21 +114,26 @@ zed_conf_destroy(struct zed_conf *zcp)
zcp->pid_file, strerror(errno));
zcp->pid_fd = -1;
}
- if (zcp->conf_file)
+ if (zcp->conf_file) {
free(zcp->conf_file);
-
- if (zcp->pid_file)
+ zcp->conf_file = NULL;
+ }
+ if (zcp->pid_file) {
free(zcp->pid_file);
-
- if (zcp->zedlet_dir)
+ zcp->pid_file = NULL;
+ }
+ if (zcp->zedlet_dir) {
free(zcp->zedlet_dir);
-
- if (zcp->state_file)
+ zcp->zedlet_dir = NULL;
+ }
+ if (zcp->state_file) {
free(zcp->state_file);
-
- if (zcp->zedlets)
+ zcp->state_file = NULL;
+ }
+ if (zcp->zedlets) {
zed_strings_destroy(zcp->zedlets);
-
+ zcp->zedlets = NULL;
+ }
free(zcp);
}