summaryrefslogtreecommitdiffstats
path: root/utils/idmapd
diff options
context:
space:
mode:
Diffstat (limited to 'utils/idmapd')
-rw-r--r--utils/idmapd/cfg.c10
-rw-r--r--utils/idmapd/idmapd.c8
2 files changed, 12 insertions, 6 deletions
diff --git a/utils/idmapd/cfg.c b/utils/idmapd/cfg.c
index b22a7c9..16d392a 100644
--- a/utils/idmapd/cfg.c
+++ b/utils/idmapd/cfg.c
@@ -487,8 +487,10 @@ conf_get_list (char *section, char *tag)
if (!node)
goto cleanup;
node->field = strdup (field);
- if (!node->field)
+ if (!node->field) {
+ free(node);
goto cleanup;
+ }
TAILQ_INSERT_TAIL (&list->fields, node, link);
}
free (liststr);
@@ -523,8 +525,10 @@ conf_get_tag_list (char *section)
if (!node)
goto cleanup;
node->field = strdup (cb->tag);
- if (!node->field)
+ if (!node->field) {
+ free(node);
goto cleanup;
+ }
TAILQ_INSERT_TAIL (&list->fields, node, link);
}
return list;
@@ -708,7 +712,7 @@ conf_remove (int transaction, char *section, char *tag)
return 0;
fail:
- if (node->section)
+ if (node && node->section)
free (node->section);
if (node)
free (node);
diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c
index 158feaf..1231db4 100644
--- a/utils/idmapd/idmapd.c
+++ b/utils/idmapd/idmapd.c
@@ -1003,9 +1003,11 @@ mydaemon(int nochdir, int noclose)
if (noclose == 0) {
tempfd = open("/dev/null", O_RDWR);
- dup2(tempfd, 0);
- dup2(tempfd, 1);
- dup2(tempfd, 2);
+ if (tempfd >= 0) {
+ dup2(tempfd, 0);
+ dup2(tempfd, 1);
+ dup2(tempfd, 2);
+ }
closeall(3);
}