summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2001-09-17 10:00:29 +0000
committerSimo Sorce <idra@samba.org>2001-09-17 10:00:29 +0000
commite7db47bffba15bd087c90b3831f05d736b8b20e5 (patch)
tree50dbc25c60b485853deb9bf77d7df17877bbf0c5
parent941a3a5d3a46fd4fb913fddc6aa956361d218d23 (diff)
downloadsamba-e7db47bffba15bd087c90b3831f05d736b8b20e5.tar.gz
samba-e7db47bffba15bd087c90b3831f05d736b8b20e5.tar.bz2
samba-e7db47bffba15bd087c90b3831f05d736b8b20e5.zip
move to SAFE_FREE()
(This used to be commit 94b0fde8a8a4e888cee93ebde79390c7942a2785)
-rw-r--r--source3/rpc_parse/parse_creds.c12
-rw-r--r--source3/rpc_parse/parse_prs.c5
-rw-r--r--source3/rpc_parse/parse_spoolss.c28
3 files changed, 17 insertions, 28 deletions
diff --git a/source3/rpc_parse/parse_creds.c b/source3/rpc_parse/parse_creds.c
index ae8ba23a56..1ad9143009 100644
--- a/source3/rpc_parse/parse_creds.c
+++ b/source3/rpc_parse/parse_creds.c
@@ -147,11 +147,7 @@ frees a structure.
********************************************************************/
void creds_free_unix_sec(CREDS_UNIX_SEC *r_u)
{
- if (r_u->grps != NULL)
- {
- free(r_u->grps);
- r_u->grps = NULL;
- }
+ SAFE_FREE(r_u->grps);
}
/*******************************************************************
@@ -225,11 +221,7 @@ frees a structure.
********************************************************************/
void creds_free_nt_sec(CREDS_NT_SEC *r_u)
{
- if (r_u->grp_rids != NULL)
- {
- free(r_u->grp_rids);
- r_u->grp_rids = NULL;
- }
+ SAFE_FREE(r_u->grp_rids);
}
/*******************************************************************
diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c
index d34465e8b4..84c9a3abf4 100644
--- a/source3/rpc_parse/parse_prs.c
+++ b/source3/rpc_parse/parse_prs.c
@@ -116,10 +116,9 @@ BOOL prs_read(prs_struct *ps, int fd, size_t len, int timeout)
void prs_mem_free(prs_struct *ps)
{
- if(ps->is_dynamic && (ps->data_p != NULL))
- free(ps->data_p);
+ if(ps->is_dynamic)
+ SAFE_FREE(ps->data_p);
ps->is_dynamic = False;
- ps->data_p = NULL;
ps->buffer_size = 0;
ps->data_offset = 0;
}
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c
index 027f8ceaa3..6e0bcdb905 100644
--- a/source3/rpc_parse/parse_spoolss.c
+++ b/source3/rpc_parse/parse_spoolss.c
@@ -1807,19 +1807,19 @@ static BOOL smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, uint16
buffer->string_at_end -= (q-p+1)*sizeof(uint16);
if(!prs_set_offset(ps, buffer->string_at_end)) {
- free(chaine.buffer);
+ SAFE_FREE(chaine.buffer);
return False;
}
/* write the string */
if (!spoolss_smb_io_unistr(desc, &chaine, ps, depth)) {
- free(chaine.buffer);
+ SAFE_FREE(chaine.buffer);
return False;
}
q++;
p=q;
- free(chaine.buffer);
+ SAFE_FREE(chaine.buffer);
}
if(!prs_set_offset(ps, struct_offset))
@@ -1868,7 +1868,7 @@ static BOOL smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, uint16
/* Yes this should be realloc - it's freed below. JRA */
if((tc2=(uint16 *)Realloc(chaine2, realloc_size)) == NULL) {
- if (chaine2) free(chaine2);
+ SAFE_FREE(chaine2);
return False;
}
else chaine2 = tc2;
@@ -1884,7 +1884,7 @@ static BOOL smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, uint16
{
chaine2[l_chaine2] = '\0';
*string=(uint16 *)talloc_memdup(prs_get_mem_context(ps),chaine2,realloc_size);
- free(chaine2);
+ SAFE_FREE(chaine2);
}
if(!prs_set_offset(ps, old_offset))
@@ -4886,7 +4886,7 @@ BOOL make_spoolss_driver_info_3(
inf->dependentfilessize = len;
if(!make_spoolss_buffer5(mem_ctx, &inf->dependentfiles, len, info3->dependentfiles))
{
- safe_free (inf);
+ SAFE_FREE(inf);
return False;
}
@@ -5003,7 +5003,7 @@ BOOL uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni,
if (uniarray_2_dosarray(&uni->dependentfiles, &d->dependentfiles ))
return True;
- free(*asc);
+ SAFE_FREE(*asc);
return False;
}
@@ -5055,7 +5055,7 @@ BOOL uni_2_asc_printer_driver_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *uni,
return True;
error:
- free(*asc);
+ SAFE_FREE(*asc);
return False;
}
@@ -5859,14 +5859,14 @@ BOOL spoolss_io_q_getjob(char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, int de
void free_devmode(DEVICEMODE *devmode)
{
if (devmode!=NULL) {
- safe_free(devmode->private);
- safe_free(devmode);
+ SAFE_FREE(devmode->private);
+ SAFE_FREE(devmode);
}
}
void free_printer_info_1(PRINTER_INFO_1 *printer)
{
- safe_free(printer);
+ SAFE_FREE(printer);
}
void free_printer_info_2(PRINTER_INFO_2 *printer)
@@ -5874,15 +5874,13 @@ void free_printer_info_2(PRINTER_INFO_2 *printer)
if (printer!=NULL) {
free_devmode(printer->devmode);
printer->devmode = NULL;
- safe_free(printer);
+ SAFE_FREE(printer);
}
}
void free_printer_info_3(PRINTER_INFO_3 *printer)
{
- if (printer!=NULL) {
- safe_free(printer);
- }
+ SAFE_FREE(printer);
}
void free_job_info_2(JOB_INFO_2 *job)