diff options
author | Simo Sorce <idra@samba.org> | 2001-09-17 00:58:15 +0000 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2001-09-17 00:58:15 +0000 |
commit | 31c3f7a8b2ff62d4cfc1ed9d831b95eba0da525f (patch) | |
tree | 5cd11ebd4485c002b5f79fcc4a5aa807482a2b11 /source3 | |
parent | 77bdea1b95f0169c32ba13a4434e9cfb4089b7d3 (diff) | |
download | samba-31c3f7a8b2ff62d4cfc1ed9d831b95eba0da525f.tar.gz samba-31c3f7a8b2ff62d4cfc1ed9d831b95eba0da525f.tar.xz samba-31c3f7a8b2ff62d4cfc1ed9d831b95eba0da525f.zip |
move to SAFE_FREE()
(This used to be commit 89833bbbd8508dcdca70dff2c94e1d8f22535f1f)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/groupdb/aliasdb.c | 6 | ||||
-rw-r--r-- | source3/groupdb/aliasfile.c | 3 | ||||
-rw-r--r-- | source3/groupdb/groupdb.c | 6 | ||||
-rw-r--r-- | source3/groupdb/groupfile.c | 3 | ||||
-rw-r--r-- | source3/groupdb/mapping.c | 19 |
5 files changed, 15 insertions, 22 deletions
diff --git a/source3/groupdb/aliasdb.c b/source3/groupdb/aliasdb.c index eff318db0d..2c96e92ee1 100644 --- a/source3/groupdb/aliasdb.c +++ b/source3/groupdb/aliasdb.c @@ -147,8 +147,7 @@ BOOL add_domain_alias(LOCAL_GRP **alss, int *num_alss, LOCAL_GRP *als) talss = Realloc((*alss), ((*num_alss)+1) * sizeof(LOCAL_GRP)); if (talss == NULL) { - if (*alss) - free(*alss); + SAFE_FREE(*alss); return False; } else (*alss) = talss; @@ -228,8 +227,7 @@ BOOL iterate_getuseraliasnam(char *user_name, LOCAL_GRP **alss, int *num_alss) ret = add_domain_alias(alss, num_alss, als); } - free(mem); - mem = NULL; + SAFE_FREE(mem); num_mem = 0; if (!ret) diff --git a/source3/groupdb/aliasfile.c b/source3/groupdb/aliasfile.c index fc4489f50e..7f07192c74 100644 --- a/source3/groupdb/aliasfile.c +++ b/source3/groupdb/aliasfile.c @@ -137,8 +137,7 @@ static char *get_alias_members(char *p, int *num_mem, LOCAL_GRP_MEMBER **members continue; } if (mbrs == NULL) { - if (*members) - free(*members); + SAFE_FREE(*members); return NULL; } else (*members) = mbrs; diff --git a/source3/groupdb/groupdb.c b/source3/groupdb/groupdb.c index 227d63e8e3..8b29a32423 100644 --- a/source3/groupdb/groupdb.c +++ b/source3/groupdb/groupdb.c @@ -145,8 +145,7 @@ BOOL add_domain_group(DOMAIN_GRP **grps, int *num_grps, DOMAIN_GRP *grp) tgrps = Realloc((*grps), ((*num_grps)+1) * sizeof(DOMAIN_GRP)); if (tgrps == NULL) { - if (*grps) - free(*grps); + SAFE_FREE(*grps); return False; } else (*grps) = tgrps; @@ -224,8 +223,7 @@ BOOL iterate_getusergroupsnam(char *user_name, DOMAIN_GRP **grps, int *num_grps) ret = add_domain_group(grps, num_grps, grp); } - free(mem); - mem = NULL; + SAFE_FREE(mem); num_mem = 0; if (!ret) diff --git a/source3/groupdb/groupfile.c b/source3/groupdb/groupfile.c index 124da186fa..f47eee555f 100644 --- a/source3/groupdb/groupfile.c +++ b/source3/groupdb/groupfile.c @@ -132,8 +132,7 @@ static char *get_group_members(char *p, int *num_mem, DOMAIN_GRP_MEMBER **member mbrs = Realloc((*members), ((*num_mem)+1) * sizeof(DOMAIN_GRP_MEMBER)); if (mbrs == NULL) { - if (*members) - free(*members); + SAFE_FREE(*members); return NULL; } else (*members) = mbrs; diff --git a/source3/groupdb/mapping.c b/source3/groupdb/mapping.c index 129f0940a2..5be6442173 100644 --- a/source3/groupdb/mapping.c +++ b/source3/groupdb/mapping.c @@ -269,7 +269,7 @@ BOOL get_group_map_from_sid(DOM_SID sid, GROUP_MAP *map) ret = tdb_unpack(dbuf.dptr, dbuf.dsize, "ddffd", &map->gid, &map->sid_name_use, &map->nt_name, &map->comment, &map->privilege); - safe_free(dbuf.dptr); + SAFE_FREE(dbuf.dptr); if (ret != dbuf.dsize) { DEBUG(0,("get_group_map_from_sid: mapping TDB corrupted ?\n")); return False; @@ -294,7 +294,7 @@ BOOL get_group_map_from_gid(gid_t gid, GROUP_MAP *map) for (kbuf = tdb_firstkey(tdb); kbuf.dptr; - newkey = tdb_nextkey(tdb, kbuf), safe_free(kbuf.dptr), kbuf=newkey) { + newkey = tdb_nextkey(tdb, kbuf), SAFE_FREE(kbuf.dptr), kbuf=newkey) { if (strncmp(kbuf.dptr, GROUP_PREFIX, strlen(GROUP_PREFIX)) != 0) continue; @@ -308,7 +308,7 @@ BOOL get_group_map_from_gid(gid_t gid, GROUP_MAP *map) ret = tdb_unpack(dbuf.dptr, dbuf.dsize, "ddffd", &map->gid, &map->sid_name_use, &map->nt_name, &map->comment, &map->privilege); - safe_free(dbuf.dptr); + SAFE_FREE(dbuf.dptr); if (ret != dbuf.dsize) continue; if (gid==map->gid) @@ -331,7 +331,7 @@ BOOL get_group_map_from_ntname(char *name, GROUP_MAP *map) for (kbuf = tdb_firstkey(tdb); kbuf.dptr; - newkey = tdb_nextkey(tdb, kbuf), safe_free(kbuf.dptr), kbuf=newkey) { + newkey = tdb_nextkey(tdb, kbuf), SAFE_FREE(kbuf.dptr), kbuf=newkey) { if (strncmp(kbuf.dptr, GROUP_PREFIX, strlen(GROUP_PREFIX)) != 0) continue; @@ -345,7 +345,7 @@ BOOL get_group_map_from_ntname(char *name, GROUP_MAP *map) ret = tdb_unpack(dbuf.dptr, dbuf.dsize, "ddffd", &map->gid, &map->sid_name_use, &map->nt_name, &map->comment, &map->privilege); - safe_free(dbuf.dptr); + SAFE_FREE(dbuf.dptr); if (ret != dbuf.dsize) continue; if (StrCaseCmp(name, map->nt_name)==0) @@ -376,7 +376,7 @@ BOOL group_map_remove(DOM_SID sid) dbuf = tdb_fetch(tdb, kbuf); if (!dbuf.dptr) return False; - safe_free(dbuf.dptr); + SAFE_FREE(dbuf.dptr); if(tdb_delete(tdb, kbuf) != TDB_SUCCESS) return False; @@ -404,7 +404,7 @@ BOOL enum_group_mapping(enum SID_NAME_USE sid_name_use, GROUP_MAP **rmap, for (kbuf = tdb_firstkey(tdb); kbuf.dptr; - newkey = tdb_nextkey(tdb, kbuf), safe_free(kbuf.dptr), kbuf=newkey) { + newkey = tdb_nextkey(tdb, kbuf), SAFE_FREE(kbuf.dptr), kbuf=newkey) { if (strncmp(kbuf.dptr, GROUP_PREFIX, strlen(GROUP_PREFIX)) != 0) continue; @@ -418,7 +418,7 @@ BOOL enum_group_mapping(enum SID_NAME_USE sid_name_use, GROUP_MAP **rmap, ret = tdb_unpack(dbuf.dptr, dbuf.dsize, "ddffd", &map.gid, &map.sid_name_use, &map.nt_name, &map.comment, &map.privilege); - safe_free(dbuf.dptr); + SAFE_FREE(dbuf.dptr); if (ret != dbuf.dsize) continue; @@ -436,8 +436,7 @@ BOOL enum_group_mapping(enum SID_NAME_USE sid_name_use, GROUP_MAP **rmap, mapt=(GROUP_MAP *)Realloc((*rmap), (entries+1)*sizeof(GROUP_MAP)); if (!mapt) { DEBUG(0,("enum_group_mapping: Unable to enlarge group map!\n")); - if (*rmap) free(*rmap); - *rmap=NULL; + SAFE_FREE(*rmap); return False; } else (*rmap) = mapt; |