summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-12-27 06:34:48 +0000
committerJeremy Allison <jra@samba.org>2001-12-27 06:34:48 +0000
commitd222a01e0f046883a602cc4591a400b8e65ef6b5 (patch)
treefc194966bc8770ad07d52ea8343bb73638f0f387
parent26e4c4099c61c7ba9f2153e56061bea9882553d9 (diff)
downloadsamba-d222a01e0f046883a602cc4591a400b8e65ef6b5.tar.gz
samba-d222a01e0f046883a602cc4591a400b8e65ef6b5.tar.xz
samba-d222a01e0f046883a602cc4591a400b8e65ef6b5.zip
Removed spurious (char *) casts in SAFE_FREE calls.
Jeremy.
-rw-r--r--source/include/smb_macros.h2
-rw-r--r--source/include/talloc.h2
-rw-r--r--source/lib/domain_namemap.c2
-rw-r--r--source/lib/replace.c2
-rw-r--r--source/nmbd/nmbd_responserecordsdb.c4
-rw-r--r--source/nmbd/nmbd_serverlistdb.c4
-rw-r--r--source/nmbd/nmbd_subnetdb.c2
-rw-r--r--source/nmbd/nmbd_winsproxy.c6
-rw-r--r--source/nmbd/nmbd_winsserver.c4
-rw-r--r--source/nsswitch/winbindd_nss.h2
-rw-r--r--source/smbd/close.c2
-rw-r--r--source/smbd/dir.c6
-rw-r--r--source/smbd/error.c2
-rw-r--r--source/smbd/groupname.c4
-rw-r--r--source/smbd/open.c16
-rw-r--r--source/smbd/oplock.c2
-rw-r--r--source/smbd/password.c2
-rw-r--r--source/smbd/process.c6
-rw-r--r--source/smbd/reply.c4
-rw-r--r--source/tdb/tdb.h2
-rw-r--r--source/utils/make_smbcodepage.c2
-rw-r--r--source/utils/make_unicodemap.c2
22 files changed, 40 insertions, 40 deletions
diff --git a/source/include/smb_macros.h b/source/include/smb_macros.h
index bcbe69146aa..8161fc70962 100644
--- a/source/include/smb_macros.h
+++ b/source/include/smb_macros.h
@@ -38,7 +38,7 @@
/* free memory if the pointer is valid and zero the pointer */
#ifndef SAFE_FREE
-#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
+#define SAFE_FREE(x) do { if ((x) != NULL) {free((x)); (x)=NULL;} } while(0)
#endif
/* zero a structure */
diff --git a/source/include/talloc.h b/source/include/talloc.h
index ee0c943c51f..06efbf6952a 100644
--- a/source/include/talloc.h
+++ b/source/include/talloc.h
@@ -34,7 +34,7 @@ typedef struct {
/* free memory if the pointer is valid and zero the pointer */
#ifndef SAFE_FREE
-#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
+#define SAFE_FREE(x) do { if ((x) != NULL) {free((x)); (x)=NULL;} } while(0)
#endif
#endif
diff --git a/source/lib/domain_namemap.c b/source/lib/domain_namemap.c
index 4465015570f..81b519a88d6 100644
--- a/source/lib/domain_namemap.c
+++ b/source/lib/domain_namemap.c
@@ -242,7 +242,7 @@ static void delete_name_entry(name_map_entry *gmep)
SAFE_FREE(gmep->grp.nt_name);
SAFE_FREE(gmep->grp.nt_domain);
SAFE_FREE(gmep->grp.unix_name);
- SAFE_FREE((char*)gmep);
+ SAFE_FREE(gmep);
}
/**************************************************************************
diff --git a/source/lib/replace.c b/source/lib/replace.c
index 5ef78d01827..16d7450d69e 100644
--- a/source/lib/replace.c
+++ b/source/lib/replace.c
@@ -192,7 +192,7 @@ Corrections by richard.kettlewell@kewill.com
}
endgrent();
ret = sys_setgroups(i,grouplst);
- SAFE_FREE((char *)grouplst);
+ SAFE_FREE(grouplst);
return ret;
#endif /* HAVE_SETGROUPS */
}
diff --git a/source/nmbd/nmbd_responserecordsdb.c b/source/nmbd/nmbd_responserecordsdb.c
index b47ea5eefa4..b24c85a9d81 100644
--- a/source/nmbd/nmbd_responserecordsdb.c
+++ b/source/nmbd/nmbd_responserecordsdb.c
@@ -81,7 +81,7 @@ void remove_response_record(struct subnet_record *subrec,
(*rrec->userdata->free_fn)(rrec->userdata);
} else {
ZERO_STRUCTP(rrec->userdata);
- SAFE_FREE((char *)rrec->userdata);
+ SAFE_FREE(rrec->userdata);
}
}
@@ -90,7 +90,7 @@ void remove_response_record(struct subnet_record *subrec,
free_packet(rrec->packet);
ZERO_STRUCTP(rrec);
- SAFE_FREE((char *)rrec);
+ SAFE_FREE(rrec);
num_response_packets--; /* count of total number of packets still around */
}
diff --git a/source/nmbd/nmbd_serverlistdb.c b/source/nmbd/nmbd_serverlistdb.c
index 4245add2630..badb4383201 100644
--- a/source/nmbd/nmbd_serverlistdb.c
+++ b/source/nmbd/nmbd_serverlistdb.c
@@ -55,7 +55,7 @@ void remove_all_servers(struct work_record *work)
work->serverlist = servrec->next;
ZERO_STRUCTP(servrec);
- SAFE_FREE((char *)servrec);
+ SAFE_FREE(servrec);
}
@@ -120,7 +120,7 @@ void remove_server_from_workgroup(struct work_record *work, struct server_record
work->serverlist = servrec->next;
ZERO_STRUCTP(servrec);
- SAFE_FREE((char *)servrec);
+ SAFE_FREE(servrec);
work->subnet->work_changed = True;
}
diff --git a/source/nmbd/nmbd_subnetdb.c b/source/nmbd/nmbd_subnetdb.c
index 8516eb425eb..9030e42b298 100644
--- a/source/nmbd/nmbd_subnetdb.c
+++ b/source/nmbd/nmbd_subnetdb.c
@@ -186,7 +186,7 @@ static struct subnet_record *make_subnet(char *name, enum subnet_type type,
close(nmb_sock);
close(dgram_sock);
ZERO_STRUCTP(subrec);
- SAFE_FREE((char *)subrec);
+ SAFE_FREE(subrec);
return(NULL);
}
diff --git a/source/nmbd/nmbd_winsproxy.c b/source/nmbd/nmbd_winsproxy.c
index 460c72a9c77..84102289587 100644
--- a/source/nmbd/nmbd_winsproxy.c
+++ b/source/nmbd/nmbd_winsproxy.c
@@ -81,7 +81,7 @@ returned for name %s.\n", nmb_namestr(nmbname) ));
WINS_PROXY_NAME, num_ips, iplist );
if(iplist != &ip)
- SAFE_FREE((char *)iplist);
+ SAFE_FREE(iplist);
/*
* Check that none of the IP addresses we are returning is on the
@@ -159,7 +159,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)
{
- SAFE_FREE((char *)new_userdata);
+ SAFE_FREE(new_userdata);
return NULL;
}
@@ -190,7 +190,7 @@ static void wins_proxy_userdata_free_fn(struct userdata_struct *userdata)
free_packet(p);
ZERO_STRUCTP(userdata);
- SAFE_FREE((char *)userdata);
+ SAFE_FREE(userdata);
}
/****************************************************************************
diff --git a/source/nmbd/nmbd_winsserver.c b/source/nmbd/nmbd_winsserver.c
index 15cb2fcb6fc..04f7ae33bbc 100644
--- a/source/nmbd/nmbd_winsserver.c
+++ b/source/nmbd/nmbd_winsserver.c
@@ -299,7 +299,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));
- SAFE_FREE((char *)ip_list);
+ SAFE_FREE(ip_list);
continue;
}
@@ -338,7 +338,7 @@ BOOL initialise_wins(void)
name, type, ttl, inet_ntoa(ip_list[0]), nb_flags));
}
- SAFE_FREE((char *)ip_list);
+ SAFE_FREE(ip_list);
}
fclose(fp);
diff --git a/source/nsswitch/winbindd_nss.h b/source/nsswitch/winbindd_nss.h
index 4fb9458c141..1a3a98e1b8a 100644
--- a/source/nsswitch/winbindd_nss.h
+++ b/source/nsswitch/winbindd_nss.h
@@ -23,7 +23,7 @@
*/
#ifndef SAFE_FREE
-#define SAFE_FREE(x) do { if(x) {free(x); x=NULL;} } while(0)
+#define SAFE_FREE(x) do { if ((x) != NULL) {free((x)); (x)=NULL;} } while(0)
#endif
#ifndef _WINBINDD_NTDOM_H
diff --git a/source/smbd/close.c b/source/smbd/close.c
index fdb95a634be..ca030ed1404 100644
--- a/source/smbd/close.c
+++ b/source/smbd/close.c
@@ -100,7 +100,7 @@ static int close_filestruct(files_struct *fsp)
fsp->stat_open = False;
conn->num_files_open--;
- SAFE_FREE((char *)fsp->wbmpx_ptr);
+ SAFE_FREE(fsp->wbmpx_ptr);
return ret;
}
diff --git a/source/smbd/dir.c b/source/smbd/dir.c
index 809e8612a17..789ff919eea 100644
--- a/source/smbd/dir.c
+++ b/source/smbd/dir.c
@@ -246,7 +246,7 @@ static void dptr_close_internal(dptr_struct *dptr)
/* Lanman 2 specific code */
SAFE_FREE(dptr->wcard);
string_set(&dptr->path,"");
- SAFE_FREE((char *)dptr);
+ SAFE_FREE(dptr);
}
/****************************************************************************
@@ -435,7 +435,7 @@ int dptr_create(connection_struct *conn,char *path, BOOL old_handle, BOOL expect
if(dptr->dnum == -1 || dptr->dnum > 254) {
DEBUG(0,("dptr_create: returned %d: Error - all old dirptrs in use ?\n", dptr->dnum));
- SAFE_FREE((char *)dptr);
+ SAFE_FREE(dptr);
return -1;
}
}
@@ -464,7 +464,7 @@ int dptr_create(connection_struct *conn,char *path, BOOL old_handle, BOOL expect
if(dptr->dnum == -1 || dptr->dnum < 255) {
DEBUG(0,("dptr_create: returned %d: Error - all new dirptrs in use ?\n", dptr->dnum));
- SAFE_FREE((char *)dptr);
+ SAFE_FREE(dptr);
return -1;
}
}
diff --git a/source/smbd/error.c b/source/smbd/error.c
index 78425fafc66..d5d6d644e78 100644
--- a/source/smbd/error.c
+++ b/source/smbd/error.c
@@ -37,7 +37,7 @@ int cached_error_packet(char *outbuf,files_struct *fsp,int line,const char *file
int32 err = wbmpx->wr_error;
/* We can now delete the auxiliary struct */
- SAFE_FREE((char *)wbmpx);
+ SAFE_FREE(wbmpx);
return error_packet(outbuf,NT_STATUS_OK,eclass,err,line,file);
}
diff --git a/source/smbd/groupname.c b/source/smbd/groupname.c
index 1cdca50e65f..2c7440d75a7 100644
--- a/source/smbd/groupname.c
+++ b/source/smbd/groupname.c
@@ -54,7 +54,7 @@ static void delete_groupname_map_list(void)
while((gmep = (groupname_map_entry *)ubi_slRemHead( &groupname_map_list )) != NULL) {
SAFE_FREE(gmep->windows_name);
SAFE_FREE(gmep->unix_name);
- SAFE_FREE((char *)gmep);
+ SAFE_FREE(gmep);
}
}
@@ -187,7 +187,7 @@ Error was %s.\n", unixname, strerror(errno) ));
fclose(fp);
SAFE_FREE(new_ep->windows_name);
SAFE_FREE(new_ep->unix_name);
- SAFE_FREE((char *)new_ep);
+ SAFE_FREE(new_ep);
file_lines_free(lines);
return;
}
diff --git a/source/smbd/open.c b/source/smbd/open.c
index 309bc0be873..10265a7ef7a 100644
--- a/source/smbd/open.c
+++ b/source/smbd/open.c
@@ -503,7 +503,7 @@ dev = %x, inode = %.0f\n", *p_oplock_request, share_entry->op_type, fname, (unsi
if(opb_ret == False) {
DEBUG(0,("open_mode_check: FAILED when breaking oplock (%x) on file %s, \
dev = %x, inode = %.0f\n", old_shares[i].op_type, fname, (unsigned int)dev, (double)inode));
- SAFE_FREE((char *)old_shares);
+ SAFE_FREE(old_shares);
errno = EACCES;
unix_ERR_class = ERRDOS;
unix_ERR_code = ERRbadshare;
@@ -522,7 +522,7 @@ dev = %x, inode = %.0f\n", old_shares[i].op_type, fname, (unsigned int)dev, (dou
if we can too */
if(check_share_mode(conn, share_entry, share_mode, fname, fcbopen, p_flags) == False) {
- SAFE_FREE((char *)old_shares);
+ SAFE_FREE(old_shares);
errno = EACCES;
return -1;
}
@@ -530,7 +530,7 @@ dev = %x, inode = %.0f\n", old_shares[i].op_type, fname, (unsigned int)dev, (dou
} /* end for */
if(broke_oplock) {
- SAFE_FREE((char *)old_shares);
+ SAFE_FREE(old_shares);
num_share_modes = get_share_modes(conn, dev, inode, &old_shares);
oplock_contention_count++;
@@ -566,7 +566,7 @@ dev = %x, inode = %.0f. Deleting it to continue...\n", (int)broken_entry.pid, fn
* other process's entry.
*/
- SAFE_FREE((char *)old_shares);
+ SAFE_FREE(old_shares);
num_share_modes = get_share_modes(conn, dev, inode, &old_shares);
break;
}
@@ -575,7 +575,7 @@ dev = %x, inode = %.0f. Deleting it to continue...\n", (int)broken_entry.pid, fn
} while(broke_oplock);
- SAFE_FREE((char *)old_shares);
+ SAFE_FREE(old_shares);
/*
* Refuse to grant an oplock in case the contention limit is
@@ -1281,7 +1281,7 @@ dev = %x, inode = %.0f\n", share_entry->op_type, fname, (unsigned int)dev, (doub
DEBUG(0,("check_file_sharing: FAILED when breaking oplock (%x) on file %s, \
dev = %x, inode = %.0f\n", old_shares[i].op_type, fname, (unsigned int)dev, (double)inode));
- SAFE_FREE((char *)old_shares);
+ SAFE_FREE(old_shares);
return False;
}
lock_share_entry(conn, dev, inode);
@@ -1311,7 +1311,7 @@ dev = %x, inode = %.0f\n", old_shares[i].op_type, fname, (unsigned int)dev, (dou
if(broke_oplock)
{
- SAFE_FREE((char *)old_shares);
+ SAFE_FREE(old_shares);
num_share_modes = get_share_modes(conn, dev, inode, &old_shares);
}
} while(broke_oplock);
@@ -1332,6 +1332,6 @@ dev = %x, inode = %.0f\n", old_shares[i].op_type, fname, (unsigned int)dev, (dou
free_and_exit:
unlock_share_entry(conn, dev, inode);
- SAFE_FREE((char *)old_shares);
+ SAFE_FREE(old_shares);
return(ret);
}
diff --git a/source/smbd/oplock.c b/source/smbd/oplock.c
index 9d285d4ae38..340a0a3906e 100644
--- a/source/smbd/oplock.c
+++ b/source/smbd/oplock.c
@@ -1162,7 +1162,7 @@ void release_level_2_oplocks_on_change(files_struct *fsp)
}
}
- SAFE_FREE((char *)share_list);
+ SAFE_FREE(share_list);
unlock_share_entry_fsp(fsp);
/* Paranoia check... */
diff --git a/source/smbd/password.c b/source/smbd/password.c
index d6d4c931748..f408a3e021d 100644
--- a/source/smbd/password.c
+++ b/source/smbd/password.c
@@ -1432,7 +1432,7 @@ static BOOL find_connect_pdc(struct cli_state *pcli, unsigned char *trust_passwd
}
}
- SAFE_FREE((char *)ip_list);
+ SAFE_FREE(ip_list);
return connected_ok;
}
diff --git a/source/smbd/process.c b/source/smbd/process.c
index b6a0c28f18e..9bebfdb902a 100644
--- a/source/smbd/process.c
+++ b/source/smbd/process.c
@@ -85,7 +85,7 @@ static BOOL push_message(ubi_slList *list_head, char *buf, int msg_len)
if(msg->msg_buf == NULL)
{
DEBUG(0,("push_message: malloc fail (2)\n"));
- SAFE_FREE((char *)msg);
+ SAFE_FREE(msg);
return False;
}
@@ -178,8 +178,8 @@ static BOOL receive_message_or_smb(char *buffer, int buffer_len, int timeout)
memcpy(buffer, msg->msg_buf, MIN(buffer_len, msg->msg_len));
/* Free the message we just copied. */
- SAFE_FREE((char *)msg->msg_buf);
- SAFE_FREE((char *)msg);
+ SAFE_FREE(msg->msg_buf);
+ SAFE_FREE(msg);
DEBUG(5,("receive_message_or_smb: returning queued smb message.\n"));
return True;
diff --git a/source/smbd/reply.c b/source/smbd/reply.c
index 4e286afe9f1..b4b1745fe20 100644
--- a/source/smbd/reply.c
+++ b/source/smbd/reply.c
@@ -4815,7 +4815,7 @@ int reply_writebs(connection_struct *conn, char *inbuf,char *outbuf, int dum_siz
if (nwritten < (ssize_t)numtowrite) {
if(write_through) {
/* We are returning an error - we can delete the aux struct */
- SAFE_FREE((char *)wbms);
+ SAFE_FREE(wbms);
fsp->wbmpx_ptr = NULL;
END_PROFILE(SMBwriteBs);
return(ERROR_DOS(ERRHRD,ERRdiskfull));
@@ -4834,7 +4834,7 @@ int reply_writebs(connection_struct *conn, char *inbuf,char *outbuf, int dum_siz
send_response = True;
}
- SAFE_FREE((char *)wbms);
+ SAFE_FREE(wbms);
fsp->wbmpx_ptr = NULL;
}
diff --git a/source/tdb/tdb.h b/source/tdb/tdb.h
index 7c1c7bd8c2b..da8cca19def 100644
--- a/source/tdb/tdb.h
+++ b/source/tdb/tdb.h
@@ -137,7 +137,7 @@ extern TDB_DATA tdb_null;
/* free memory if the pointer is valid and zero the pointer */
#ifndef SAFE_FREE
-#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
+#define SAFE_FREE(x) do { if ((x) != NULL) {free((x)); (x)=NULL;} } while(0)
#endif
#ifdef __cplusplus
diff --git a/source/utils/make_smbcodepage.c b/source/utils/make_smbcodepage.c
index 46b0bf227bb..256dde7c0d1 100644
--- a/source/utils/make_smbcodepage.c
+++ b/source/utils/make_smbcodepage.c
@@ -209,7 +209,7 @@ The maximum size I will believe is 100k.\n", prog_name, size);
{
fprintf(stderr, "%s: read failed for file %s. Error was %s.\n", prog_name,
input_file, strerror(errno));
- SAFE_FREE((char *)buf);
+ SAFE_FREE(buf);
fclose(fp);
exit(1);
}
diff --git a/source/utils/make_unicodemap.c b/source/utils/make_unicodemap.c
index 926f21d85c5..79c63ff003c 100644
--- a/source/utils/make_unicodemap.c
+++ b/source/utils/make_unicodemap.c
@@ -172,7 +172,7 @@ static int do_compile(const char *codepage, const char *input_file, const char *
if(fread( buf, 1, size, fp) != size) {
fprintf(stderr, "%s: read failed for file %s. Error was %s.\n", prog_name,
input_file, strerror(errno));
- SAFE_FREE((char *)buf);
+ SAFE_FREE(buf);
fclose(fp);
exit(1);
}