summaryrefslogtreecommitdiff
path: root/source3/smbd/msdfs.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-12-07 18:25:53 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:53:32 -0500
commitacf9d61421faa6c0055d57fdee7db300dc5431aa (patch)
tree5482afecfe9b4a68b9a1f18d541a3109f8143ab7 /source3/smbd/msdfs.c
parent3bd3be97dc8a581c0502410453091c195e322766 (diff)
downloadsamba-acf9d61421faa6c0055d57fdee7db300dc5431aa.tar.gz
samba-acf9d61421faa6c0055d57fdee7db300dc5431aa.tar.bz2
samba-acf9d61421faa6c0055d57fdee7db300dc5431aa.zip
r4088: Get medieval on our ass about malloc.... :-). Take control of all our allocation
functions so we can funnel through some well known functions. Should help greatly with malloc checking. HEAD patch to follow. Jeremy. (This used to be commit 620f2e608f70ba92f032720c031283d295c5c06a)
Diffstat (limited to 'source3/smbd/msdfs.c')
-rw-r--r--source3/smbd/msdfs.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c
index 6c132897f9..b5ae7486d3 100644
--- a/source3/smbd/msdfs.c
+++ b/source3/smbd/msdfs.c
@@ -189,7 +189,7 @@ static BOOL parse_symlink(char* buf,struct referral** preflist,
DEBUG(10,("parse_symlink: count=%d\n", count));
- reflist = *preflist = (struct referral*) malloc(count * sizeof(struct referral));
+ reflist = *preflist = SMB_MALLOC_ARRAY(struct referral, count);
if(reflist == NULL) {
DEBUG(0,("parse_symlink: Malloc failed!\n"));
return False;
@@ -417,7 +417,7 @@ static BOOL self_ref(char *pathname, struct junction_map *jucn,
*self_referralp = True;
jucn->referral_count = 1;
- if((ref = (struct referral*) malloc(sizeof(struct referral))) == NULL) {
+ if((ref = SMB_MALLOC_P(struct referral)) == NULL) {
DEBUG(0,("self_ref: malloc failed for referral\n"));
return False;
}
@@ -503,7 +503,7 @@ BOOL get_referred_path(char *pathname, struct junction_map *jucn,
self_referralp);
jucn->referral_count = 1;
- if ((ref = (struct referral*) malloc(sizeof(struct referral))) == NULL) {
+ if ((ref = SMB_MALLOC_P(struct referral)) == NULL) {
DEBUG(0, ("malloc failed for referral\n"));
goto out;
}
@@ -595,7 +595,7 @@ static int setup_ver2_dfs_referral(char* pathname, char** ppdata,
/* add the unexplained 0x16 bytes */
reply_size += 0x16;
- pdata = Realloc(pdata,reply_size);
+ pdata = SMB_REALLOC(pdata,reply_size);
if(pdata == NULL) {
DEBUG(0,("malloc failed for Realloc!\n"));
return -1;
@@ -676,7 +676,7 @@ static int setup_ver3_dfs_referral(char* pathname, char** ppdata,
reply_size += (strlen(junction->referral_list[i].alternate_path)+1)*2;
}
- pdata = Realloc(pdata,reply_size);
+ pdata = SMB_REALLOC(pdata,reply_size);
if(pdata == NULL) {
DEBUG(0,("version3 referral setup: malloc failed for Realloc!\n"));
return -1;
@@ -962,8 +962,7 @@ static BOOL form_junctions(int snum, struct junction_map* jucn, int* jn_count)
jucn[cnt].volume_name[0] = '\0';
jucn[cnt].referral_count = 1;
- ref = jucn[cnt].referral_list
- = (struct referral*) malloc(sizeof(struct referral));
+ ref = jucn[cnt].referral_list = SMB_MALLOC_P(struct referral);
if (jucn[cnt].referral_list == NULL) {
DEBUG(0, ("Malloc failed!\n"));
goto out;