1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

move to SAFE_FREE()

(This used to be commit 1446a1562b)
This commit is contained in:
Simo Sorce 2001-09-17 04:35:51 +00:00
parent 23af074326
commit 1f312492ec
14 changed files with 37 additions and 39 deletions

View File

@ -614,7 +614,7 @@ static BOOL init_structs(void)
if (nodup)
my_netbios_names[namecount++] = nbname;
else
free(nbname);
SAFE_FREE(nbname);
ptr++;
}

View File

@ -56,7 +56,7 @@ ubi_dlNewList( lmb_browserlist );
*/
static void remove_lmb_browser_entry( struct browse_cache_record *browc )
{
free( (char *)ubi_dlRemThis( lmb_browserlist, browc ) );
safe_free( ubi_dlRemThis( lmb_browserlist, browc ) );
} /* remove_lmb_browser_entry */
/* ************************************************************************** **

View File

@ -581,8 +581,8 @@ on the same subnet (%s) as the requestor. Not replying.\n",
if (!success && bcast)
{
if((prdata != rdata) && (prdata != NULL))
free(prdata);
if(prdata != rdata)
SAFE_FREE(prdata);
return; /* Never reply with a negative response to broadcasts. */
}
@ -594,8 +594,8 @@ on the same subnet (%s) as the requestor. Not replying.\n",
if(!success && !bcast && nmb->header.nm_flags.recursion_desired)
{
if((prdata != rdata) && (prdata != NULL))
free(prdata);
if(prdata != rdata)
SAFE_FREE(prdata);
return;
}
@ -620,6 +620,6 @@ on the same subnet (%s) as the requestor. Not replying.\n",
prdata, /* data to send. */
reply_data_len); /* data length. */
if((prdata != rdata) && (prdata != NULL))
free(prdata);
if(prdata != rdata)
SAFE_FREE(prdata);
}

View File

@ -78,9 +78,8 @@ static void update_name_in_namelist( struct subnet_record *subrec,
(void)ubi_trInsert( subrec->namelist, namerec, &(namerec->name), &oldrec );
if( oldrec )
{
if( oldrec->data.ip )
free( oldrec->data.ip );
free( oldrec );
SAFE_FREE( oldrec->data.ip );
SAFE_FREE( oldrec );
}
} /* update_name_in_namelist */
@ -93,11 +92,10 @@ void remove_name_from_namelist( struct subnet_record *subrec,
{
(void)ubi_trRemove( subrec->namelist, namerec );
if(namerec->data.ip != NULL)
free((char *)namerec->data.ip);
SAFE_FREE(namerec->data.ip);
ZERO_STRUCTP(namerec);
free((char *)namerec);
SAFE_FREE(namerec);
subrec->namelist_changed = True;
} /* remove_name_from_namelist */
@ -206,7 +204,7 @@ struct name_record *add_name_to_subnet( struct subnet_record *subrec,
DEBUG( 0, ( "add_name_to_subnet: malloc fail when creating ip_flgs.\n" ) );
ZERO_STRUCTP(namerec);
free( (char *)namerec );
SAFE_FREE(namerec);
return NULL;
}
@ -353,7 +351,7 @@ void add_ip_to_name_record( struct name_record *namerec, struct in_addr new_ip )
namerec->data.num_ips * sizeof(struct in_addr) );
new_list[namerec->data.num_ips] = new_ip;
free((char *)namerec->data.ip);
SAFE_FREE(namerec->data.ip);
namerec->data.ip = new_list;
namerec->data.num_ips += 1;
@ -520,7 +518,7 @@ void add_samba_names_to_subnet( struct subnet_record *subrec )
PERMANENT_NAME, num_ips, iplist);
if(iplist != &subrec->myip)
free((char *)iplist);
SAFE_FREE(iplist);
}
/****************************************************************************

View File

@ -310,12 +310,12 @@ static BOOL multihomed_register_name( struct nmb_name *nmbname, uint16 nb_flags,
DEBUG(0,("multihomed_register_name: Failed to send packet trying to \
register name %s IP %s\n", nmb_namestr(nmbname), inet_ntoa(ip_list[i]) ));
free((char *)ip_list);
SAFE_FREE(ip_list);
return True;
}
}
free((char *)ip_list);
SAFE_FREE(ip_list);
return False;
}

View File

@ -1758,8 +1758,8 @@ only use %d.\n", (count*2) + 2, FD_SETSIZE));
*listen_number = (count*2) + 2;
if (*ppset) free(*ppset);
if (*psock_array) free(*psock_array);
SAFE_FREE(*ppset);
SAFE_FREE(*psock_array);
*ppset = pset;
*psock_array = sock_array;

View File

@ -367,7 +367,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
q += 2; /* LMNT token (0xff) */
q += 2; /* LM20 token (0xff) */
free(db_info); /* Not sure whether we need to do anything
SAFE_FREE(db_info); /* Not sure whether we need to do anything
useful with these */
/* Send message to smbd */

View File

@ -83,7 +83,7 @@ void remove_response_record(struct subnet_record *subrec,
(*rrec->userdata->free_fn)(rrec->userdata);
} else {
ZERO_STRUCTP(rrec->userdata);
free((char *)rrec->userdata);
SAFE_FREE(rrec->userdata);
}
}
@ -92,7 +92,7 @@ void remove_response_record(struct subnet_record *subrec,
free_packet(rrec->packet);
ZERO_STRUCTP(rrec);
free((char *)rrec);
SAFE_FREE(rrec);
num_response_packets--; /* count of total number of packets still around */
}
@ -138,7 +138,7 @@ struct response_record *make_response_record( struct subnet_record *subrec,
{
DEBUG(0,("make_response_queue_record: copy fail for userdata.\n"));
ZERO_STRUCTP(rrec);
free(rrec);
SAFE_FREE(rrec);
return NULL;
}
}
@ -150,7 +150,7 @@ struct response_record *make_response_record( struct subnet_record *subrec,
{
DEBUG(0,("make_response_queue_record: malloc fail for userdata.\n"));
ZERO_STRUCTP(rrec);
free(rrec);
SAFE_FREE(rrec);
return NULL;
}
rrec->userdata->copy_fn = userdata->copy_fn;

View File

@ -57,7 +57,7 @@ void remove_all_servers(struct work_record *work)
work->serverlist = servrec->next;
ZERO_STRUCTP(servrec);
free((char *)servrec);
SAFE_FREE(servrec);
}
@ -122,7 +122,7 @@ void remove_server_from_workgroup(struct work_record *work, struct server_record
work->serverlist = servrec->next;
ZERO_STRUCTP(servrec);
free((char *)servrec);
SAFE_FREE(servrec);
work->subnet->work_changed = True;
}

View File

@ -188,7 +188,7 @@ static struct subnet_record *make_subnet(char *name, enum subnet_type type,
close(nmb_sock);
close(dgram_sock);
ZERO_STRUCTP(subrec);
free((char *)subrec);
SAFE_FREE(subrec);
return(NULL);
}

View File

@ -294,7 +294,7 @@ void sync_check_completion(void)
complete_sync(s);
DLIST_REMOVE(syncs, s);
ZERO_STRUCTP(s);
free(s);
SAFE_FREE(s);
}
}
}

View File

@ -83,7 +83,7 @@ returned for name %s.\n", nmb_namestr(nmbname) ));
WINS_PROXY_NAME, num_ips, iplist );
if(iplist != &ip)
free((char *)iplist);
SAFE_FREE(iplist);
/*
* Check that none of the IP addresses we are returning is on the
@ -161,7 +161,7 @@ static struct userdata_struct *wins_proxy_userdata_copy_fn(struct userdata_struc
/* Do a deep copy of the packet. */
if((copy_of_p = copy_packet(p)) == NULL)
{
free((char *)new_userdata);
SAFE_FREE(new_userdata);
return NULL;
}
@ -192,7 +192,7 @@ static void wins_proxy_userdata_free_fn(struct userdata_struct *userdata)
free_packet(p);
ZERO_STRUCTP(userdata);
free((char *)userdata);
SAFE_FREE(userdata);
}
/****************************************************************************

View File

@ -300,7 +300,7 @@ BOOL initialise_wins(void)
if(nb_flags_str[strlen(nb_flags_str)-1] == 'S')
{
DEBUG(5,("initialise_wins: Ignoring SELF name %s\n", line));
free((char *)ip_list);
SAFE_FREE(ip_list);
continue;
}
@ -339,7 +339,7 @@ BOOL initialise_wins(void)
name, type, ttl, inet_ntoa(ip_list[0]), nb_flags));
}
free((char *)ip_list);
SAFE_FREE(ip_list);
}
x_fclose(fp);
@ -1281,7 +1281,7 @@ static void process_wins_dmb_query_request(struct subnet_record *subrec,
prdata, /* data to send. */
num_ips*6); /* data length. */
free(prdata);
SAFE_FREE(prdata);
}
/****************************************************************************
@ -1338,8 +1338,8 @@ void send_wins_name_query_response(int rcode, struct packet_struct *p,
prdata, /* data to send. */
reply_data_len); /* data length. */
if((prdata != rdata) && (prdata != NULL))
free(prdata);
if(prdata != rdata)
SAFE_FREE(prdata);
}
/***********************************************************************

View File

@ -142,7 +142,7 @@ static struct work_record *remove_workgroup_from_subnet(struct subnet_record *su
subrec->workgrouplist = work->next;
ZERO_STRUCTP(work);
free((char *)work);
SAFE_FREE(work);
}
subrec->work_changed = True;