diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/nmbd/nmbd.c | 2 | ||||
-rw-r--r-- | source3/nmbd/nmbd_browserdb.c | 2 | ||||
-rw-r--r-- | source3/nmbd/nmbd_incomingrequests.c | 12 | ||||
-rw-r--r-- | source3/nmbd/nmbd_namelistdb.c | 16 | ||||
-rw-r--r-- | source3/nmbd/nmbd_nameregister.c | 4 | ||||
-rw-r--r-- | source3/nmbd/nmbd_packets.c | 4 | ||||
-rw-r--r-- | source3/nmbd/nmbd_processlogon.c | 2 | ||||
-rw-r--r-- | source3/nmbd/nmbd_responserecordsdb.c | 8 | ||||
-rw-r--r-- | source3/nmbd/nmbd_serverlistdb.c | 4 | ||||
-rw-r--r-- | source3/nmbd/nmbd_subnetdb.c | 2 | ||||
-rw-r--r-- | source3/nmbd/nmbd_synclists.c | 2 | ||||
-rw-r--r-- | source3/nmbd/nmbd_winsproxy.c | 6 | ||||
-rw-r--r-- | source3/nmbd/nmbd_winsserver.c | 10 | ||||
-rw-r--r-- | source3/nmbd/nmbd_workgroupdb.c | 2 |
14 files changed, 37 insertions, 39 deletions
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index d8d0aa4626..6fead637eb 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -614,7 +614,7 @@ static BOOL init_structs(void) if (nodup) my_netbios_names[namecount++] = nbname; else - free(nbname); + SAFE_FREE(nbname); ptr++; } diff --git a/source3/nmbd/nmbd_browserdb.c b/source3/nmbd/nmbd_browserdb.c index 10d22431e9..9523152840 100644 --- a/source3/nmbd/nmbd_browserdb.c +++ b/source3/nmbd/nmbd_browserdb.c @@ -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 */ /* ************************************************************************** ** diff --git a/source3/nmbd/nmbd_incomingrequests.c b/source3/nmbd/nmbd_incomingrequests.c index c59c045bad..b390755be5 100644 --- a/source3/nmbd/nmbd_incomingrequests.c +++ b/source3/nmbd/nmbd_incomingrequests.c @@ -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); } diff --git a/source3/nmbd/nmbd_namelistdb.c b/source3/nmbd/nmbd_namelistdb.c index 281197df65..fe2c0c0f21 100644 --- a/source3/nmbd/nmbd_namelistdb.c +++ b/source3/nmbd/nmbd_namelistdb.c @@ -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); } /**************************************************************************** diff --git a/source3/nmbd/nmbd_nameregister.c b/source3/nmbd/nmbd_nameregister.c index 6d4d66cbef..6b7bb6a73a 100644 --- a/source3/nmbd/nmbd_nameregister.c +++ b/source3/nmbd/nmbd_nameregister.c @@ -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; } diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c index 00059c1775..ab4b2c5e89 100644 --- a/source3/nmbd/nmbd_packets.c +++ b/source3/nmbd/nmbd_packets.c @@ -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; diff --git a/source3/nmbd/nmbd_processlogon.c b/source3/nmbd/nmbd_processlogon.c index 4f98a23584..9923d352dc 100644 --- a/source3/nmbd/nmbd_processlogon.c +++ b/source3/nmbd/nmbd_processlogon.c @@ -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 */ diff --git a/source3/nmbd/nmbd_responserecordsdb.c b/source3/nmbd/nmbd_responserecordsdb.c index 1b6e1ca16d..b4376d6405 100644 --- a/source3/nmbd/nmbd_responserecordsdb.c +++ b/source3/nmbd/nmbd_responserecordsdb.c @@ -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; diff --git a/source3/nmbd/nmbd_serverlistdb.c b/source3/nmbd/nmbd_serverlistdb.c index 711ddb2490..cbc48d2313 100644 --- a/source3/nmbd/nmbd_serverlistdb.c +++ b/source3/nmbd/nmbd_serverlistdb.c @@ -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; } diff --git a/source3/nmbd/nmbd_subnetdb.c b/source3/nmbd/nmbd_subnetdb.c index e77a47801d..996952451d 100644 --- a/source3/nmbd/nmbd_subnetdb.c +++ b/source3/nmbd/nmbd_subnetdb.c @@ -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); } diff --git a/source3/nmbd/nmbd_synclists.c b/source3/nmbd/nmbd_synclists.c index e3ea67f135..7ba39f0cd4 100644 --- a/source3/nmbd/nmbd_synclists.c +++ b/source3/nmbd/nmbd_synclists.c @@ -294,7 +294,7 @@ void sync_check_completion(void) complete_sync(s); DLIST_REMOVE(syncs, s); ZERO_STRUCTP(s); - free(s); + SAFE_FREE(s); } } } diff --git a/source3/nmbd/nmbd_winsproxy.c b/source3/nmbd/nmbd_winsproxy.c index 24ba192cdb..d3118e82e1 100644 --- a/source3/nmbd/nmbd_winsproxy.c +++ b/source3/nmbd/nmbd_winsproxy.c @@ -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); } /**************************************************************************** diff --git a/source3/nmbd/nmbd_winsserver.c b/source3/nmbd/nmbd_winsserver.c index 10eaf91e8a..621a23b9e2 100644 --- a/source3/nmbd/nmbd_winsserver.c +++ b/source3/nmbd/nmbd_winsserver.c @@ -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); } /*********************************************************************** diff --git a/source3/nmbd/nmbd_workgroupdb.c b/source3/nmbd/nmbd_workgroupdb.c index 01477c8113..6bb156b41f 100644 --- a/source3/nmbd/nmbd_workgroupdb.c +++ b/source3/nmbd/nmbd_workgroupdb.c @@ -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; |