summaryrefslogtreecommitdiff
path: root/source3/client
diff options
context:
space:
mode:
Diffstat (limited to 'source3/client')
-rw-r--r--source3/client/client.c28
-rw-r--r--source3/client/clitar.c22
2 files changed, 25 insertions, 25 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index 8c43f4e16e..7470a7ba5f 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -387,7 +387,7 @@ static void init_do_list_queue(void)
{
reset_do_list_queue();
do_list_queue_size = 1024;
- do_list_queue = malloc(do_list_queue_size);
+ do_list_queue = SMB_MALLOC(do_list_queue_size);
if (do_list_queue == 0) {
d_printf("malloc fail for size %d\n",
(int)do_list_queue_size);
@@ -425,7 +425,7 @@ static void add_to_do_list_queue(const char* entry)
do_list_queue_size *= 2;
DEBUG(4,("enlarging do_list_queue to %d\n",
(int)do_list_queue_size));
- dlq = Realloc(do_list_queue, do_list_queue_size);
+ dlq = SMB_REALLOC(do_list_queue, do_list_queue_size);
if (! dlq) {
d_printf("failure enlarging do_list_queue to %d bytes\n",
(int)do_list_queue_size);
@@ -704,7 +704,7 @@ static int do_get(char *rname, char *lname, BOOL reget)
DEBUG(1,("getting file %s of size %.0f as %s ",
rname, (double)size, lname));
- if(!(data = (char *)malloc(read_size))) {
+ if(!(data = (char *)SMB_MALLOC(read_size))) {
d_printf("malloc fail for size %d\n", read_size);
cli_close(cli, fnum);
return 1;
@@ -1112,7 +1112,7 @@ static int do_put(char *rname, char *lname, BOOL reput)
DEBUG(1,("putting file %s as %s ",lname,
rname));
- buf = (char *)malloc(maxwrite);
+ buf = (char *)SMB_MALLOC(maxwrite);
if (!buf) {
d_printf("ERROR: Not enough memory!\n");
return 1;
@@ -1325,7 +1325,7 @@ static int file_find(struct file_list **list, const char *directory,
return -1;
}
}
- entry = (struct file_list *) malloc(sizeof (struct file_list));
+ entry = SMB_MALLOC_P(struct file_list);
if (!entry) {
d_printf("Out of memory in file_find\n");
closedir(dir);
@@ -2698,7 +2698,7 @@ static void completion_remote_filter(file_info *f, const char *mask, void *state
if ((info->count < MAX_COMPLETIONS - 1) && (strncmp(info->text, f->name, info->len) == 0) && (strcmp(f->name, ".") != 0) && (strcmp(f->name, "..") != 0)) {
if ((info->dirmask[0] == 0) && !(f->mode & aDIR))
- info->matches[info->count] = strdup(f->name);
+ info->matches[info->count] = SMB_STRDUP(f->name);
else {
pstring tmp;
@@ -2709,7 +2709,7 @@ static void completion_remote_filter(file_info *f, const char *mask, void *state
pstrcat(tmp, f->name);
if (f->mode & aDIR)
pstrcat(tmp, "/");
- info->matches[info->count] = strdup(tmp);
+ info->matches[info->count] = SMB_STRDUP(tmp);
}
if (info->matches[info->count] == NULL)
return;
@@ -2740,7 +2740,7 @@ static char **remote_completion(const char *text, int len)
if (len >= PATH_MAX)
return(NULL);
- info.matches = (char **)malloc(sizeof(info.matches[0])*MAX_COMPLETIONS);
+ info.matches = SMB_MALLOC_ARRAY(char *,MAX_COMPLETIONS);
if (!info.matches) return NULL;
info.matches[0] = NULL;
@@ -2761,9 +2761,9 @@ static char **remote_completion(const char *text, int len)
goto cleanup;
if (info.count == 2)
- info.matches[0] = strdup(info.matches[1]);
+ info.matches[0] = SMB_STRDUP(info.matches[1]);
else {
- info.matches[0] = malloc(info.samelen+1);
+ info.matches[0] = SMB_MALLOC(info.samelen+1);
if (!info.matches[0])
goto cleanup;
strncpy(info.matches[0], info.matches[1], info.samelen);
@@ -2818,7 +2818,7 @@ static char **completion_fn(const char *text, int start, int end)
char **matches;
int i, len, samelen = 0, count=1;
- matches = (char **)malloc(sizeof(matches[0])*MAX_COMPLETIONS);
+ matches = SMB_MALLOC_ARRAY(char *, MAX_COMPLETIONS);
if (!matches) {
return NULL;
}
@@ -2827,7 +2827,7 @@ static char **completion_fn(const char *text, int start, int end)
len = strlen(text);
for (i=0;commands[i].fn && count < MAX_COMPLETIONS-1;i++) {
if (strncmp(text, commands[i].name, len) == 0) {
- matches[count] = strdup(commands[i].name);
+ matches[count] = SMB_STRDUP(commands[i].name);
if (!matches[count])
goto cleanup;
if (count == 1)
@@ -2844,10 +2844,10 @@ static char **completion_fn(const char *text, int start, int end)
case 1:
goto cleanup;
case 2:
- matches[0] = strdup(matches[1]);
+ matches[0] = SMB_STRDUP(matches[1]);
break;
default:
- matches[0] = malloc(samelen+1);
+ matches[0] = SMB_MALLOC(samelen+1);
if (!matches[0])
goto cleanup;
strncpy(matches[0], matches[1], samelen);
diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index b4d6273f7b..a92be1abe3 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -146,7 +146,7 @@ static char *string_create_s(int size)
{
char *tmp;
- tmp = (char *)malloc(size+1);
+ tmp = (char *)SMB_MALLOC(size+1);
if (tmp == NULL) {
DEBUG(0, ("Out of memory in string_create_s\n"));
@@ -177,7 +177,7 @@ static void writetarheader(int f, const char *aname, SMB_BIG_UINT size, time_t m
if (l+2 >= NAMSIZ) {
/* write a GNU tar style long header */
char *b;
- b = (char *)malloc(l+TBLOCK+100);
+ b = (char *)SMB_MALLOC(l+TBLOCK+100);
if (!b) {
DEBUG(0,("out of memory\n"));
exit(1);
@@ -385,7 +385,7 @@ static void initarbuf(void)
{
/* initialize tar buffer */
tbufsiz=blocksize*TBLOCK;
- tarbuf=malloc(tbufsiz); /* FIXME: We might not get the buffer */
+ tarbuf=SMB_MALLOC(tbufsiz); /* FIXME: We might not get the buffer */
/* reset tar buffer pointer and tar file counter and total dumped */
tp=0; ntarf=0; ttarf=0;
@@ -1059,7 +1059,7 @@ static char *get_longfilename(file_info2 finfo)
/* finfo.size here is the length of the filename as written by the "/./@LongLink" name
* header call. */
int namesize = finfo.size + strlen(cur_dir) + 2;
- char *longname = malloc(namesize);
+ char *longname = SMB_MALLOC(namesize);
int offset = 0, left = finfo.size;
BOOL first = True;
@@ -1506,7 +1506,7 @@ static int read_inclusion_file(char *filename)
while ((! error) && (x_fgets(buf, sizeof(buf)-1, inclusion))) {
if (inclusion_buffer == NULL) {
inclusion_buffer_size = 1024;
- if ((inclusion_buffer = malloc(inclusion_buffer_size)) == NULL) {
+ if ((inclusion_buffer = SMB_MALLOC(inclusion_buffer_size)) == NULL) {
DEBUG(0,("failure allocating buffer to read inclusion file\n"));
error = 1;
break;
@@ -1520,7 +1520,7 @@ static int read_inclusion_file(char *filename)
if ((strlen(buf) + 1 + inclusion_buffer_sofar) >= inclusion_buffer_size) {
char *ib;
inclusion_buffer_size *= 2;
- ib = Realloc(inclusion_buffer,inclusion_buffer_size);
+ ib = SMB_REALLOC(inclusion_buffer,inclusion_buffer_size);
if (! ib) {
DEBUG(0,("failure enlarging inclusion buffer to %d bytes\n",
inclusion_buffer_size));
@@ -1539,7 +1539,7 @@ static int read_inclusion_file(char *filename)
if (! error) {
/* Allocate an array of clipn + 1 char*'s for cliplist */
- cliplist = malloc((clipn + 1) * sizeof(char *));
+ cliplist = SMB_MALLOC_ARRAY(char *, clipn + 1);
if (cliplist == NULL) {
DEBUG(0,("failure allocating memory for cliplist\n"));
error = 1;
@@ -1550,7 +1550,7 @@ static int read_inclusion_file(char *filename)
/* set current item to NULL so array will be null-terminated even if
* malloc fails below. */
cliplist[i] = NULL;
- if ((tmpstr = (char *)malloc(strlen(p)+1)) == NULL) {
+ if ((tmpstr = (char *)SMB_MALLOC(strlen(p)+1)) == NULL) {
DEBUG(0, ("Could not allocate space for a cliplist item, # %i\n", i));
error = 1;
} else {
@@ -1720,7 +1720,7 @@ int tar_parseargs(int argc, char *argv[], const char *Optarg, int Optind)
clipn=argc-Optind-1;
clipcount = clipn;
- if ((tmplist=malloc(clipn*sizeof(char *))) == NULL) {
+ if ((tmplist=SMB_MALLOC_ARRAY(char *,clipn)) == NULL) {
DEBUG(0, ("Could not allocate space to process cliplist, count = %i\n", clipn));
return 0;
}
@@ -1729,7 +1729,7 @@ int tar_parseargs(int argc, char *argv[], const char *Optarg, int Optind)
DEBUG(5, ("Processing an item, %s\n", cliplist[clipcount]));
- if ((tmpstr = (char *)malloc(strlen(cliplist[clipcount])+1)) == NULL) {
+ if ((tmpstr = (char *)SMB_MALLOC(strlen(cliplist[clipcount])+1)) == NULL) {
DEBUG(0, ("Could not allocate space for a cliplist item, # %i\n", clipcount));
return 0;
}
@@ -1751,7 +1751,7 @@ int tar_parseargs(int argc, char *argv[], const char *Optarg, int Optind)
#ifdef HAVE_REGEX_H
int errcode;
- if ((preg = (regex_t *)malloc(65536)) == NULL) {
+ if ((preg = (regex_t *)SMB_MALLOC(65536)) == NULL) {
DEBUG(0, ("Could not allocate buffer for regular expression search\n"));
return;