diff options
author | bapt <bapt@FreeBSD.org> | 2012-12-28 20:21:14 +0000 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2012-12-28 20:21:14 +0000 |
commit | 83035e89840797684386d0bd3a46f2c24030771b (patch) | |
tree | aca467cf8c539f40829ec641032b063a09507bb7 /lib/libutil | |
parent | b69ff2af2f03611d0e09375381f91413c7d309a2 (diff) | |
download | FreeBSD-src-83035e89840797684386d0bd3a46f2c24030771b.zip FreeBSD-src-83035e89840797684386d0bd3a46f2c24030771b.tar.gz |
malloc() sets errno to ENOMEM already.
Submitted by: Christoph Mallon <christoph.mallon@gmx.de>
Diffstat (limited to 'lib/libutil')
-rw-r--r-- | lib/libutil/gr_util.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/libutil/gr_util.c b/lib/libutil/gr_util.c index 759e6e8..6676720 100644 --- a/lib/libutil/gr_util.c +++ b/lib/libutil/gr_util.c @@ -505,17 +505,13 @@ gr_add(struct group *gr, char *newmember) } /* Allocate enough for current pointers + 1 more and NULL marker */ mlen = (num_mem + 2) * sizeof(*gr->gr_mem); - if ((members = malloc(mlen)) == NULL) { + if ((members = malloc(mlen)) == NULL) errno = ENOMEM; - return (NULL); - } memcpy(members, gr->gr_mem, num_mem * sizeof(*gr->gr_mem)); members[num_mem++] = newmember; members[num_mem] = NULL; gr->gr_mem = members; newgr = gr_dup(gr); - if (newgr == NULL) - errno = ENOMEM; free(members); return (newgr); } |