summaryrefslogtreecommitdiff
path: root/source3/client/clitar.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/client/clitar.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/client/clitar.c')
-rw-r--r--source3/client/clitar.c22
1 files changed, 11 insertions, 11 deletions
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;