mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
move to SAFE_FREE()
This commit is contained in:
parent
549fe42bd4
commit
94b0fde8a8
@ -147,11 +147,7 @@ frees a structure.
|
|||||||
********************************************************************/
|
********************************************************************/
|
||||||
void creds_free_unix_sec(CREDS_UNIX_SEC *r_u)
|
void creds_free_unix_sec(CREDS_UNIX_SEC *r_u)
|
||||||
{
|
{
|
||||||
if (r_u->grps != NULL)
|
SAFE_FREE(r_u->grps);
|
||||||
{
|
|
||||||
free(r_u->grps);
|
|
||||||
r_u->grps = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
@ -225,11 +221,7 @@ frees a structure.
|
|||||||
********************************************************************/
|
********************************************************************/
|
||||||
void creds_free_nt_sec(CREDS_NT_SEC *r_u)
|
void creds_free_nt_sec(CREDS_NT_SEC *r_u)
|
||||||
{
|
{
|
||||||
if (r_u->grp_rids != NULL)
|
SAFE_FREE(r_u->grp_rids);
|
||||||
{
|
|
||||||
free(r_u->grp_rids);
|
|
||||||
r_u->grp_rids = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
|
@ -116,10 +116,9 @@ BOOL prs_read(prs_struct *ps, int fd, size_t len, int timeout)
|
|||||||
|
|
||||||
void prs_mem_free(prs_struct *ps)
|
void prs_mem_free(prs_struct *ps)
|
||||||
{
|
{
|
||||||
if(ps->is_dynamic && (ps->data_p != NULL))
|
if(ps->is_dynamic)
|
||||||
free(ps->data_p);
|
SAFE_FREE(ps->data_p);
|
||||||
ps->is_dynamic = False;
|
ps->is_dynamic = False;
|
||||||
ps->data_p = NULL;
|
|
||||||
ps->buffer_size = 0;
|
ps->buffer_size = 0;
|
||||||
ps->data_offset = 0;
|
ps->data_offset = 0;
|
||||||
}
|
}
|
||||||
|
@ -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);
|
buffer->string_at_end -= (q-p+1)*sizeof(uint16);
|
||||||
|
|
||||||
if(!prs_set_offset(ps, buffer->string_at_end)) {
|
if(!prs_set_offset(ps, buffer->string_at_end)) {
|
||||||
free(chaine.buffer);
|
SAFE_FREE(chaine.buffer);
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write the string */
|
/* write the string */
|
||||||
if (!spoolss_smb_io_unistr(desc, &chaine, ps, depth)) {
|
if (!spoolss_smb_io_unistr(desc, &chaine, ps, depth)) {
|
||||||
free(chaine.buffer);
|
SAFE_FREE(chaine.buffer);
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
q++;
|
q++;
|
||||||
p=q;
|
p=q;
|
||||||
|
|
||||||
free(chaine.buffer);
|
SAFE_FREE(chaine.buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!prs_set_offset(ps, struct_offset))
|
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 */
|
/* Yes this should be realloc - it's freed below. JRA */
|
||||||
|
|
||||||
if((tc2=(uint16 *)Realloc(chaine2, realloc_size)) == NULL) {
|
if((tc2=(uint16 *)Realloc(chaine2, realloc_size)) == NULL) {
|
||||||
if (chaine2) free(chaine2);
|
SAFE_FREE(chaine2);
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
else chaine2 = tc2;
|
else chaine2 = tc2;
|
||||||
@ -1884,7 +1884,7 @@ static BOOL smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, uint16
|
|||||||
{
|
{
|
||||||
chaine2[l_chaine2] = '\0';
|
chaine2[l_chaine2] = '\0';
|
||||||
*string=(uint16 *)talloc_memdup(prs_get_mem_context(ps),chaine2,realloc_size);
|
*string=(uint16 *)talloc_memdup(prs_get_mem_context(ps),chaine2,realloc_size);
|
||||||
free(chaine2);
|
SAFE_FREE(chaine2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!prs_set_offset(ps, old_offset))
|
if(!prs_set_offset(ps, old_offset))
|
||||||
@ -4886,7 +4886,7 @@ BOOL make_spoolss_driver_info_3(
|
|||||||
inf->dependentfilessize = len;
|
inf->dependentfilessize = len;
|
||||||
if(!make_spoolss_buffer5(mem_ctx, &inf->dependentfiles, len, info3->dependentfiles))
|
if(!make_spoolss_buffer5(mem_ctx, &inf->dependentfiles, len, info3->dependentfiles))
|
||||||
{
|
{
|
||||||
safe_free (inf);
|
SAFE_FREE(inf);
|
||||||
return False;
|
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 ))
|
if (uniarray_2_dosarray(&uni->dependentfiles, &d->dependentfiles ))
|
||||||
return True;
|
return True;
|
||||||
|
|
||||||
free(*asc);
|
SAFE_FREE(*asc);
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5055,7 +5055,7 @@ BOOL uni_2_asc_printer_driver_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *uni,
|
|||||||
return True;
|
return True;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
free(*asc);
|
SAFE_FREE(*asc);
|
||||||
return False;
|
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)
|
void free_devmode(DEVICEMODE *devmode)
|
||||||
{
|
{
|
||||||
if (devmode!=NULL) {
|
if (devmode!=NULL) {
|
||||||
safe_free(devmode->private);
|
SAFE_FREE(devmode->private);
|
||||||
safe_free(devmode);
|
SAFE_FREE(devmode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_printer_info_1(PRINTER_INFO_1 *printer)
|
void free_printer_info_1(PRINTER_INFO_1 *printer)
|
||||||
{
|
{
|
||||||
safe_free(printer);
|
SAFE_FREE(printer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_printer_info_2(PRINTER_INFO_2 *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) {
|
if (printer!=NULL) {
|
||||||
free_devmode(printer->devmode);
|
free_devmode(printer->devmode);
|
||||||
printer->devmode = NULL;
|
printer->devmode = NULL;
|
||||||
safe_free(printer);
|
SAFE_FREE(printer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_printer_info_3(PRINTER_INFO_3 *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)
|
void free_job_info_2(JOB_INFO_2 *job)
|
||||||
|
Loading…
Reference in New Issue
Block a user