summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/idmapd/cfg.c10
-rw-r--r--utils/idmapd/idmapd.c8
-rw-r--r--utils/rquotad/rquota_server.c3
-rw-r--r--utils/statd/notlist.c6
4 files changed, 19 insertions, 8 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);
}
diff --git a/utils/rquotad/rquota_server.c b/utils/rquotad/rquota_server.c
index 109c94e..e3715bd 100644
--- a/utils/rquotad/rquota_server.c
+++ b/utils/rquotad/rquota_server.c
@@ -201,7 +201,6 @@ getquota_rslt *getquotainfo(int flags, caddr_t *argp, struct svc_req *rqstp)
free(qfpathname);
continue;
}
- free(qfpathname);
lseek(fd, (long) dqoff(id), L_SET);
switch (read(fd, &dq_dqb, sizeof(struct dqblk))) {
case 0:/* EOF */
@@ -215,6 +214,7 @@ getquota_rslt *getquotainfo(int flags, caddr_t *argp, struct svc_req *rqstp)
break;
default: /* ERROR */
close(fd);
+ free(qfpathname);
continue;
}
close(fd);
@@ -228,6 +228,7 @@ getquota_rslt *getquotainfo(int flags, caddr_t *argp, struct svc_req *rqstp)
dqb.dqb_btime = dq_dqb.dqb_btime;
dqb.dqb_itime = dq_dqb.dqb_itime;
}
+ free(qfpathname);
endmntent(fp);
if (err && (flags & ACTIVE)) {
diff --git a/utils/statd/notlist.c b/utils/statd/notlist.c
index 4f52b1d..98aa6e2 100644
--- a/utils/statd/notlist.c
+++ b/utils/statd/notlist.c
@@ -61,8 +61,12 @@ nlist_new(char *my_name, char *mon_name, int state)
NL_TIMES(new) = MAX_TRIES;
NL_STATE(new) = state;
if (!(NL_MY_NAME(new) = xstrdup(my_name))
- || !(NL_MON_NAME(new) = xstrdup(mon_name)))
+ || !(NL_MON_NAME(new) = xstrdup(mon_name))) {
+ if (NL_MY_NAME(new))
+ free(NL_MY_NAME(new));
+ free(new);
return NULL;
+ }
return new;
}