diff options
author | Andrew Tridgell <tridge@samba.org> | 2002-01-13 11:46:04 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2002-01-13 11:46:04 +0000 |
commit | 2f4a6d60ef3c332c4379337a6354f9d5b78646c6 (patch) | |
tree | ff707e9165da10928e1aeaeca498f5cdc060ddde /source3 | |
parent | 0d1ecbbb73e958707612f9c9308c1d20e9b84909 (diff) | |
download | samba-2f4a6d60ef3c332c4379337a6354f9d5b78646c6.tar.gz samba-2f4a6d60ef3c332c4379337a6354f9d5b78646c6.tar.xz samba-2f4a6d60ef3c332c4379337a6354f9d5b78646c6.zip |
don't try to allocate zero bytes
(This used to be commit d09616da6823b69a03a8a008987c4eb02ca0061b)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/groupdb/mapping.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/source3/groupdb/mapping.c b/source3/groupdb/mapping.c index e732f26c156..c4166ac259c 100644 --- a/source3/groupdb/mapping.c +++ b/source3/groupdb/mapping.c @@ -530,11 +530,10 @@ BOOL get_group_map_from_sid(DOM_SID sid, GROUP_MAP *map, BOOL with_priv) ret += tdb_unpack(dbuf.dptr+ret, dbuf.dsize-ret, "d", &set->count); DEBUG(10,("get_group_map_from_sid: %d privileges\n", map->priv_set.count)); - - set->set=(LUID_ATTR *)malloc(set->count*sizeof(LUID_ATTR)); - if (set->set==NULL) { - DEBUG(0,("get_group_map_from_sid: could not allocate memory for privileges\n")); - return False; + + set->set = NULL; + if (set->count) { + set->set=(LUID_ATTR *)smb_xmalloc(set->count*sizeof(LUID_ATTR)); } for (i=0; i<set->count; i++) @@ -591,11 +590,9 @@ BOOL get_group_map_from_gid(gid_t gid, GROUP_MAP *map, BOOL with_priv) set=&map->priv_set; ret += tdb_unpack(dbuf.dptr+ret, dbuf.dsize-ret, "d", &set->count); - - set->set=(LUID_ATTR *)malloc(set->count*sizeof(LUID_ATTR)); - if (set->set==NULL) { - DEBUG(0,("get_group_map_from_gid: could not allocate memory for privileges\n")); - return False; + set->set = NULL; + if (set->count) { + set->set=(LUID_ATTR *)smb_xmalloc(set->count*sizeof(LUID_ATTR)); } for (i=0; i<set->count; i++) |