summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2001-09-17 04:58:38 +0000
committerSimo Sorce <idra@samba.org>2001-09-17 04:58:38 +0000
commit84ab9d2cb369dc0b2af0da4d2dc66c03c0a3f0a2 (patch)
tree0e928847a492ffd764f304440a33dfffc6dbe3f4 /source3
parentb50d10c2a313b45bbc195b13a353a20af0ab917a (diff)
downloadsamba-84ab9d2cb369dc0b2af0da4d2dc66c03c0a3f0a2.tar.gz
samba-84ab9d2cb369dc0b2af0da4d2dc66c03c0a3f0a2.tar.bz2
samba-84ab9d2cb369dc0b2af0da4d2dc66c03c0a3f0a2.zip
move to SAFE_FREE()
(This used to be commit fb0984e60fd69100d9866304b83b4f3c85e9aea2)
Diffstat (limited to 'source3')
-rw-r--r--source3/param/loadparm.c38
-rw-r--r--source3/param/params.c8
2 files changed, 20 insertions, 26 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 4e057929b0..2856eaf75b 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -1747,11 +1747,7 @@ static void free_service(service * pservice)
pservice->szService));
string_free(&pservice->szService);
- if (pservice->copymap)
- {
- free(pservice->copymap);
- pservice->copymap = NULL;
- }
+ SAFE_FREE(pservice->copymap);
for (i = 0; parm_table[i].label; i++)
{
@@ -2160,13 +2156,13 @@ static void add_to_file_list(char *fname, char *subfname)
f->name = strdup(fname);
if (!f->name)
{
- free(f);
+ SAFE_FREE(f);
return;
}
f->subfname = strdup(subfname);
if (!f->subfname)
{
- free(f);
+ SAFE_FREE(f);
return;
}
file_lists = f;
@@ -2203,7 +2199,7 @@ BOOL lp_file_list_changed(void)
("file %s modified: %s\n", n2,
ctime(&mod_time)));
f->modtime = mod_time;
- free(f->subfname);
+ SAFE_FREE(f->subfname);
f->subfname = strdup(n2);
return (True);
}
@@ -2486,8 +2482,7 @@ initialise a copymap
static void init_copymap(service * pservice)
{
int i;
- if (pservice->copymap)
- free(pservice->copymap);
+ SAFE_FREE(pservice->copymap);
pservice->copymap = (BOOL *)malloc(sizeof(BOOL) * NUMPARAMETERS);
if (!pservice->copymap)
DEBUG(0,
@@ -3074,7 +3069,7 @@ static void lp_add_auto_services(char *str)
lp_add_home(p, homes, home);
}
}
- free(s);
+ SAFE_FREE(s);
}
/***************************************************************************
@@ -3622,8 +3617,8 @@ char **lp_list_make(char *string)
rlist = (char **)Realloc(list, ((sizeof(char **)) * (lsize +1)));
if (!rlist) {
DEBUG(0,("lp_list_make: Unable to allocate memory"));
- lp_list_free (&list);
- free (s);
+ lp_list_free(&list);
+ SAFE_FREE(s);
return NULL;
}
else list = rlist;
@@ -3633,15 +3628,15 @@ char **lp_list_make(char *string)
list[num] = strdup(tok);
if (!list[num]) {
DEBUG(0,("lp_list_make: Unable to allocate memory"));
- lp_list_free (&list);
- free (s);
+ lp_list_free(&list);
+ SAFE_FREE(s);
return NULL;
}
num++;
}
- free (s);
+ SAFE_FREE(s);
return list;
}
@@ -3663,7 +3658,7 @@ BOOL lp_list_copy(char ***dest, char **src)
rlist = (char **)Realloc(list, ((sizeof(char **)) * (lsize +1)));
if (!rlist) {
DEBUG(0,("lp_list_copy: Unable to allocate memory"));
- lp_list_free (&list);
+ lp_list_free(&list);
return False;
}
else list = rlist;
@@ -3673,7 +3668,7 @@ BOOL lp_list_copy(char ***dest, char **src)
list[num] = strdup(src[num]);
if (!list[num]) {
DEBUG(0,("lp_list_copy: Unable to allocate memory"));
- lp_list_free (&list);
+ lp_list_free(&list);
return False;
}
@@ -3706,9 +3701,8 @@ void lp_list_free(char ***list)
if (!list || !*list) return;
tlist = *list;
- for(; *tlist; tlist++) free(*tlist);
- free (*list);
- *list = NULL;
+ for(; *tlist; tlist++) SAFE_FREE(*tlist);
+ SAFE_FREE(*list);
}
BOOL lp_list_substitute(char **list, const char *pattern, const char *insert)
@@ -3742,7 +3736,7 @@ BOOL lp_list_substitute(char **list, const char *pattern, const char *insert)
}
memcpy(t, *list, d);
memcpy(t +d +li, p +lp, ls -d -lp +1);
- free (*list);
+ SAFE_FREE(*list);
*list = t;
ls += ld;
s = t +d +li;
diff --git a/source3/param/params.c b/source3/param/params.c
index 9416965919..d12081fb32 100644
--- a/source3/param/params.c
+++ b/source3/param/params.c
@@ -121,8 +121,8 @@ static int mygetc(myFILE *f)
static void myfile_close(myFILE *f)
{
if (!f) return;
- if (f->buf) free(f->buf);
- free(f);
+ SAFE_FREE(f->buf);
+ SAFE_FREE(f);
}
/* -------------------------------------------------------------------------- **
@@ -532,7 +532,7 @@ static myFILE *OpenConfFile( char *FileName )
DEBUG( lvl,
("%s Unable to open configuration file \"%s\":\n\t%s\n",
func, FileName, strerror(errno)) );
- free(ret);
+ SAFE_FREE(ret);
return NULL;
}
@@ -582,7 +582,7 @@ BOOL pm_process( char *FileName,
return( False );
}
result = Parse( InFile, sfunc, pfunc );
- free( bufr );
+ SAFE_FREE( bufr );
bufr = NULL;
bSize = 0;
}