summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2001-09-17 05:04:17 +0000
committerSimo Sorce <idra@samba.org>2001-09-17 05:04:17 +0000
commit4561e8a8ea35f3703ff607f604b5e25cd6144da1 (patch)
tree62ccc07737b271115dbc830bfa148bdee8a1a298
parent84ab9d2cb369dc0b2af0da4d2dc66c03c0a3f0a2 (diff)
downloadsamba-4561e8a8ea35f3703ff607f604b5e25cd6144da1.tar.gz
samba-4561e8a8ea35f3703ff607f604b5e25cd6144da1.tar.bz2
samba-4561e8a8ea35f3703ff607f604b5e25cd6144da1.zip
move to SAFE_FREE()
(This used to be commit 64d35e94fe6f7e56353b286162f670c8595a90e6)
-rw-r--r--source3/auth/pampass.c21
-rw-r--r--source3/passdb/pampass.c21
-rw-r--r--source3/passdb/passdb.c19
-rw-r--r--source3/passdb/pdb_smbpasswd.c8
-rw-r--r--source3/passdb/pdb_tdb.c2
-rw-r--r--source3/passdb/secrets.c6
6 files changed, 31 insertions, 46 deletions
diff --git a/source3/auth/pampass.c b/source3/auth/pampass.c
index fda4a54103..116ecaf95b 100644
--- a/source3/auth/pampass.c
+++ b/source3/auth/pampass.c
@@ -159,7 +159,7 @@ static int smb_pam_conv(int num_msg,
default:
/* Must be an error of some sort... */
- free(reply);
+ SAFE_FREE(reply);
return PAM_CONV_ERR;
}
}
@@ -250,7 +250,7 @@ static void free_pw_chat(struct chat_struct *list)
while (list) {
struct chat_struct *old_head = list;
DLIST_REMOVE(list, list);
- free(old_head);
+ SAFE_FREE(old_head);
}
}
@@ -325,8 +325,7 @@ static int smb_pam_passchange_conv(int num_msg,
if (!found) {
DEBUG(3,("smb_pam_passchange_conv: Could not find reply for PAM prompt: %s\n",msg[replies]->msg));
free_pw_chat(pw_chat);
- free(reply);
- reply = NULL;
+ SAFE_FREE(reply);
return PAM_CONV_ERR;
}
break;
@@ -358,8 +357,7 @@ static int smb_pam_passchange_conv(int num_msg,
if (!found) {
DEBUG(3,("smb_pam_passchange_conv: Could not find reply for PAM prompt: %s\n",msg[replies]->msg));
free_pw_chat(pw_chat);
- free(reply);
- reply = NULL;
+ SAFE_FREE(reply);
return PAM_CONV_ERR;
}
break;
@@ -376,8 +374,7 @@ static int smb_pam_passchange_conv(int num_msg,
default:
/* Must be an error of some sort... */
free_pw_chat(pw_chat);
- free(reply);
- reply = NULL;
+ SAFE_FREE(reply);
return PAM_CONV_ERR;
}
}
@@ -395,9 +392,9 @@ static int smb_pam_passchange_conv(int num_msg,
static void smb_free_pam_conv(struct pam_conv *pconv)
{
if (pconv)
- safe_free(pconv->appdata_ptr);
+ SAFE_FREE(pconv->appdata_ptr);
- safe_free(pconv);
+ SAFE_FREE(pconv);
}
/***************************************************************************
@@ -411,8 +408,8 @@ static struct pam_conv *smb_setup_pam_conv(smb_pam_conv_fn smb_pam_conv_fnptr, c
struct smb_pam_userdata *udp = (struct smb_pam_userdata *)malloc(sizeof(struct smb_pam_userdata));
if (pconv == NULL || udp == NULL) {
- safe_free(pconv);
- safe_free(udp);
+ SAFE_FREE(pconv);
+ SAFE_FREE(udp);
return NULL;
}
diff --git a/source3/passdb/pampass.c b/source3/passdb/pampass.c
index fda4a54103..116ecaf95b 100644
--- a/source3/passdb/pampass.c
+++ b/source3/passdb/pampass.c
@@ -159,7 +159,7 @@ static int smb_pam_conv(int num_msg,
default:
/* Must be an error of some sort... */
- free(reply);
+ SAFE_FREE(reply);
return PAM_CONV_ERR;
}
}
@@ -250,7 +250,7 @@ static void free_pw_chat(struct chat_struct *list)
while (list) {
struct chat_struct *old_head = list;
DLIST_REMOVE(list, list);
- free(old_head);
+ SAFE_FREE(old_head);
}
}
@@ -325,8 +325,7 @@ static int smb_pam_passchange_conv(int num_msg,
if (!found) {
DEBUG(3,("smb_pam_passchange_conv: Could not find reply for PAM prompt: %s\n",msg[replies]->msg));
free_pw_chat(pw_chat);
- free(reply);
- reply = NULL;
+ SAFE_FREE(reply);
return PAM_CONV_ERR;
}
break;
@@ -358,8 +357,7 @@ static int smb_pam_passchange_conv(int num_msg,
if (!found) {
DEBUG(3,("smb_pam_passchange_conv: Could not find reply for PAM prompt: %s\n",msg[replies]->msg));
free_pw_chat(pw_chat);
- free(reply);
- reply = NULL;
+ SAFE_FREE(reply);
return PAM_CONV_ERR;
}
break;
@@ -376,8 +374,7 @@ static int smb_pam_passchange_conv(int num_msg,
default:
/* Must be an error of some sort... */
free_pw_chat(pw_chat);
- free(reply);
- reply = NULL;
+ SAFE_FREE(reply);
return PAM_CONV_ERR;
}
}
@@ -395,9 +392,9 @@ static int smb_pam_passchange_conv(int num_msg,
static void smb_free_pam_conv(struct pam_conv *pconv)
{
if (pconv)
- safe_free(pconv->appdata_ptr);
+ SAFE_FREE(pconv->appdata_ptr);
- safe_free(pconv);
+ SAFE_FREE(pconv);
}
/***************************************************************************
@@ -411,8 +408,8 @@ static struct pam_conv *smb_setup_pam_conv(smb_pam_conv_fn smb_pam_conv_fnptr, c
struct smb_pam_userdata *udp = (struct smb_pam_userdata *)malloc(sizeof(struct smb_pam_userdata));
if (pconv == NULL || udp == NULL) {
- safe_free(pconv);
- safe_free(udp);
+ SAFE_FREE(pconv);
+ SAFE_FREE(udp);
return NULL;
}
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index ac9f83b464..7d133fdda8 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -150,14 +150,9 @@ BOOL pdb_free_sam(SAM_ACCOUNT *user)
return False;
}
- if (user->nt_pw)
- free(user->nt_pw);
-
- if (user->lm_pw)
- free(user->lm_pw);
-
- free(user);
- user = NULL;
+ SAFE_FREE(user->nt_pw);
+ SAFE_FREE(user->lm_pw);
+ SAFE_FREE(user);
return True;
}
@@ -173,12 +168,8 @@ BOOL pdb_reset_sam(SAM_ACCOUNT *user)
return False;
}
- if (user->nt_pw)
- free(user->nt_pw);
-
- if (user->lm_pw)
- free(user->lm_pw);
-
+ SAFE_FREE(user->nt_pw);
+ SAFE_FREE(user->lm_pw);
ZERO_STRUCTP(user);
return True;
diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c
index 1d532c0d50..7c95feb8ca 100644
--- a/source3/passdb/pdb_smbpasswd.c
+++ b/source3/passdb/pdb_smbpasswd.c
@@ -640,11 +640,11 @@ Error was %s. Password file may be corrupt ! Please examine by hand !\n",
}
endsmbfilepwent(fp, &pw_file_lock_depth);
- free(new_entry);
+ SAFE_FREE(new_entry);
return False;
}
- free(new_entry);
+ SAFE_FREE(new_entry);
endsmbfilepwent(fp, &pw_file_lock_depth);
return True;
}
@@ -1121,11 +1121,11 @@ Error was %s\n", pwd->smb_name, pfile2, strerror(errno)));
unlink(pfile2);
endsmbfilepwent(fp, &pw_file_lock_depth);
endsmbfilepwent(fp_write, &pfile2_lockdepth);
- free(new_entry);
+ SAFE_FREE(new_entry);
return False;
}
- free(new_entry);
+ SAFE_FREE(new_entry);
}
/*
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
index 28fbb52209..6aa26bea53 100644
--- a/source3/passdb/pdb_tdb.c
+++ b/source3/passdb/pdb_tdb.c
@@ -331,7 +331,7 @@ static uint32 init_buffer_from_sam (uint8 **buf, SAM_ACCOUNT *sampass)
if (buflen != len)
{
/* error */
- free (*buf);
+ SAFE_FREE (*buf);
return (-1);
}
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c
index e69b7204e1..69b55b4d8c 100644
--- a/source3/passdb/secrets.c
+++ b/source3/passdb/secrets.c
@@ -106,12 +106,12 @@ BOOL secrets_fetch_domain_sid(char *domain, DOM_SID *sid)
if (size != sizeof(DOM_SID))
{
- free(dyn_sid);
+ SAFE_FREE(dyn_sid);
return False;
}
*sid = *dyn_sid;
- free(dyn_sid);
+ SAFE_FREE(dyn_sid);
return True;
}
@@ -145,7 +145,7 @@ BOOL secrets_fetch_trust_account_password(char *domain, uint8 ret_pwd[16],
if (pass_last_set_time) *pass_last_set_time = pass->mod_time;
memcpy(ret_pwd, pass->hash, 16);
- free(pass);
+ SAFE_FREE(pass);
return True;
}