summaryrefslogtreecommitdiff
path: root/source3/modules
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/modules
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/modules')
-rw-r--r--source3/modules/vfs_netatalk.c7
-rw-r--r--source3/modules/vfs_recycle.c10
-rw-r--r--source3/modules/vfs_shadow_copy.c6
3 files changed, 11 insertions, 12 deletions
diff --git a/source3/modules/vfs_netatalk.c b/source3/modules/vfs_netatalk.c
index 68b8aad0ac..1b36914bbe 100644
--- a/source3/modules/vfs_netatalk.c
+++ b/source3/modules/vfs_netatalk.c
@@ -126,16 +126,15 @@ static void atalk_add_to_list(name_compare_entry **list)
}
}
- if (!(new_list = calloc(1,
- (count == 0 ? 1 : count + 1) * sizeof(name_compare_entry))))
+ if (!(new_list = SMB_CALLOC_ARRAY(name_compare_entry, (count == 0 ? 1 : count + 1))))
return;
for (i = 0; i < count; i ++) {
- new_list[i].name = strdup(cur_list[i].name);
+ new_list[i].name = SMB_STRDUP(cur_list[i].name);
new_list[i].is_wild = cur_list[i].is_wild;
}
- new_list[i].name = strdup(APPLEDOUBLE);
+ new_list[i].name = SMB_STRDUP(APPLEDOUBLE);
new_list[i].is_wild = False;
free_namearray(*list);
diff --git a/source3/modules/vfs_recycle.c b/source3/modules/vfs_recycle.c
index 1cb1cb327b..5ff7931c58 100644
--- a/source3/modules/vfs_recycle.c
+++ b/source3/modules/vfs_recycle.c
@@ -215,12 +215,12 @@ static BOOL recycle_create_dir(vfs_handle_struct *handle, const char *dname)
mode = S_IRUSR | S_IWUSR | S_IXUSR;
- tmp_str = strdup(dname);
+ tmp_str = SMB_STRDUP(dname);
ALLOC_CHECK(tmp_str, done);
tok_str = tmp_str;
len = strlen(dname)+1;
- new_dir = (char *)malloc(len + 1);
+ new_dir = (char *)SMB_MALLOC(len + 1);
ALLOC_CHECK(new_dir, done);
*new_dir = '\0';
@@ -389,11 +389,11 @@ static int recycle_unlink(vfs_handle_struct *handle, connection_struct *conn, co
base = strrchr(file_name, '/');
if (base == NULL) {
base = file_name;
- path_name = strdup("/");
+ path_name = SMB_STRDUP("/");
ALLOC_CHECK(path_name, done);
}
else {
- path_name = strdup(file_name);
+ path_name = SMB_STRDUP(file_name);
ALLOC_CHECK(path_name, done);
path_name[base - file_name] = '\0';
base++;
@@ -422,7 +422,7 @@ static int recycle_unlink(vfs_handle_struct *handle, connection_struct *conn, co
if (recycle_keep_dir_tree(handle) == True) {
asprintf(&temp_name, "%s/%s", repository, path_name);
} else {
- temp_name = strdup(repository);
+ temp_name = SMB_STRDUP(repository);
}
ALLOC_CHECK(temp_name, done);
diff --git a/source3/modules/vfs_shadow_copy.c b/source3/modules/vfs_shadow_copy.c
index 88135c0aed..133e8e9c64 100644
--- a/source3/modules/vfs_shadow_copy.c
+++ b/source3/modules/vfs_shadow_copy.c
@@ -82,7 +82,7 @@ static DIR *shadow_copy_opendir(vfs_handle_struct *handle, connection_struct *co
return NULL;
}
- dirp = (shadow_copy_Dir *)malloc(sizeof(shadow_copy_Dir));
+ dirp = SMB_MALLOC_P(shadow_copy_Dir);
if (!dirp) {
DEBUG(0,("shadow_copy_opendir: Out of memory\n"));
SMB_VFS_NEXT_CLOSEDIR(handle,conn,p);
@@ -108,7 +108,7 @@ static DIR *shadow_copy_opendir(vfs_handle_struct *handle, connection_struct *co
DEBUG(10,("shadow_copy_opendir: not hide [%s]\n",d->d_name));
- r = (SMB_STRUCT_DIRENT *)Realloc(dirp->dirs,(dirp->num+1)*sizeof(SMB_STRUCT_DIRENT));
+ r = SMB_REALLOC_ARRAY(dirp->dirs,SMB_STRUCT_DIRENT, dirp->num+1);
if (!r) {
DEBUG(0,("shadow_copy_opendir: Out of memory\n"));
break;
@@ -176,7 +176,7 @@ static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle, files_str
continue;
}
- tlabels = (SHADOW_COPY_LABEL *)talloc_realloc(shadow_copy_data->mem_ctx,
+ tlabels = (SHADOW_COPY_LABEL *)TALLOC_REALLOC(shadow_copy_data->mem_ctx,
shadow_copy_data->labels,
(shadow_copy_data->num_volumes+1)*sizeof(SHADOW_COPY_LABEL));
if (tlabels == NULL) {