summaryrefslogtreecommitdiff
path: root/cifs.upcall.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@samba.org>2017-02-23 19:09:12 -0500
committerJeff Layton <jlayton@samba.org>2017-02-24 07:12:14 -0500
commit4850d321c3ec8f1b31b162fe8a316a7638c12b94 (patch)
treebbbb9b98917bf66e7524ac1754cf2ee54a6809dc /cifs.upcall.c
parent2333c502f81c66e186123e1b739a056fb049d5e4 (diff)
downloadcifs-utils-4850d321c3ec8f1b31b162fe8a316a7638c12b94.tar.gz
cifs-utils-4850d321c3ec8f1b31b162fe8a316a7638c12b94.tar.bz2
cifs-utils-4850d321c3ec8f1b31b162fe8a316a7638c12b94.zip
treewide: Eliminate SAFE_FREE
It just frees and then zeroes out the pointer. That's of dubious value in the places where it's currently being used. Just use free() instead. Signed-off-by: Jeff Layton <jlayton@samba.org>
Diffstat (limited to 'cifs.upcall.c')
-rw-r--r--cifs.upcall.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/cifs.upcall.c b/cifs.upcall.c
index cfc926c..15e1e0f 100644
--- a/cifs.upcall.c
+++ b/cifs.upcall.c
@@ -82,8 +82,6 @@ typedef enum _sectype {
#define KRB5_KEY_DATA_CAST krb5_octet
#endif
-#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x = NULL; } } while (0)
-
#ifdef HAVE_LIBCAP_NG
static int
trim_capabilities(bool need_environ)
@@ -162,7 +160,7 @@ static char *cifs_krb5_principal_get_realm(krb5_principal principal)
#if !defined(HAVE_KRB5_FREE_UNPARSED_NAME)
static void krb5_free_unparsed_name(krb5_context context, char *val)
{
- SAFE_FREE(val);
+ free(val);
}
#endif
@@ -650,7 +648,7 @@ decode_key_description(const char *desc, struct decoded_args *arg)
len = pos - tkn;
len -= 5;
- SAFE_FREE(arg->hostname);
+ free(arg->hostname);
arg->hostname = strndup(tkn + 5, len);
if (arg->hostname == NULL) {
syslog(LOG_ERR, "Unable to allocate memory");
@@ -665,7 +663,7 @@ decode_key_description(const char *desc, struct decoded_args *arg)
len = pos - tkn;
len -= 4;
- SAFE_FREE(arg->ip);
+ free(arg->ip);
arg->ip = strndup(tkn + 4, len);
if (arg->ip == NULL) {
syslog(LOG_ERR, "Unable to allocate memory");
@@ -680,7 +678,7 @@ decode_key_description(const char *desc, struct decoded_args *arg)
len = pos - tkn;
len -= 5;
- SAFE_FREE(arg->username);
+ free(arg->username);
arg->username = strndup(tkn + 5, len);
if (arg->username == NULL) {
syslog(LOG_ERR, "Unable to allocate memory");
@@ -968,7 +966,7 @@ int main(const int argc, char *const argv[])
}
have = decode_key_description(buf, &arg);
- SAFE_FREE(buf);
+ free(buf);
if ((have & DKD_MUSTHAVE_SET) != DKD_MUSTHAVE_SET) {
syslog(LOG_ERR, "unable to get necessary params from key "
"description (0x%x)", have);
@@ -1207,11 +1205,11 @@ out:
krb5_cc_close(context, ccache);
if (context)
krb5_free_context(context);
- SAFE_FREE(arg.hostname);
- SAFE_FREE(arg.ip);
- SAFE_FREE(arg.username);
- SAFE_FREE(keydata);
- SAFE_FREE(env_cachename);
+ free(arg.hostname);
+ free(arg.ip);
+ free(arg.username);
+ free(keydata);
+ free(env_cachename);
syslog(LOG_DEBUG, "Exit status %ld", rc);
return rc;
}