summaryrefslogtreecommitdiff
path: root/source4/lib/util_getent.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-12-03 07:20:30 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:06:20 -0500
commit6e6374cb5bcffb4df8bdb0a83327fff92b61ac84 (patch)
treefa45bc8c1a7281492f39069e5edd86da6d0c5d4e /source4/lib/util_getent.c
parente5ce904ddbd6175ba86ed827bf096b76b11b5511 (diff)
downloadsamba-6e6374cb5bcffb4df8bdb0a83327fff92b61ac84.tar.gz
samba-6e6374cb5bcffb4df8bdb0a83327fff92b61ac84.tar.bz2
samba-6e6374cb5bcffb4df8bdb0a83327fff92b61ac84.zip
r4055: fixed more places to use type safe allocation macros
(This used to be commit eec698254f67365f27b4b7569fa982e22472aca1)
Diffstat (limited to 'source4/lib/util_getent.c')
-rw-r--r--source4/lib/util_getent.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/source4/lib/util_getent.c b/source4/lib/util_getent.c
index 599e4bb917..9f58472fb8 100644
--- a/source4/lib/util_getent.c
+++ b/source4/lib/util_getent.c
@@ -33,7 +33,7 @@ struct sys_grent * getgrent_list(void)
struct sys_grent *gent;
struct group *grp;
- gent = (struct sys_grent *) malloc(sizeof(struct sys_grent));
+ gent = malloc_p(struct sys_grent);
if (gent == NULL) {
DEBUG (0, ("Out of memory in getgrent_list!\n"));
return NULL;
@@ -67,7 +67,7 @@ struct sys_grent * getgrent_list(void)
;
/* alloc space for gr_mem string pointers */
- if ((gent->gr_mem = (char **) malloc((num+1) * sizeof(char *))) == NULL)
+ if ((gent->gr_mem = malloc_array_p(char *, num+1)) == NULL)
goto err;
memset(gent->gr_mem, '\0', (num+1) * sizeof(char *));
@@ -80,7 +80,7 @@ struct sys_grent * getgrent_list(void)
grp = getgrent();
if (grp) {
- gent->next = (struct sys_grent *) malloc(sizeof(struct sys_grent));
+ gent->next = malloc_p(struct sys_grent);
if (gent->next == NULL)
goto err;
gent = gent->next;
@@ -134,7 +134,7 @@ struct sys_pwent * getpwent_list(void)
struct sys_pwent *pent;
struct passwd *pwd;
- pent = (struct sys_pwent *) malloc(sizeof(struct sys_pwent));
+ pent = malloc_p(struct sys_pwent);
if (pent == NULL) {
DEBUG (0, ("Out of memory in getpwent_list!\n"));
return NULL;
@@ -170,7 +170,7 @@ struct sys_pwent * getpwent_list(void)
pwd = getpwent();
if (pwd) {
- pent->next = (struct sys_pwent *) malloc(sizeof(struct sys_pwent));
+ pent->next = malloc_p(struct sys_pwent);
if (pent->next == NULL)
goto err;
pent = pent->next;
@@ -223,7 +223,7 @@ static struct sys_userlist *add_members_to_userlist(struct sys_userlist *list_he
;
for (i = 0; i < num_users; i++) {
- struct sys_userlist *entry = (struct sys_userlist *)malloc(sizeof(*entry));
+ struct sys_userlist *entry = malloc_p(struct sys_userlist);
if (entry == NULL) {
free_userlist(list_head);
return NULL;