krb5 commit: Get rid of krb5_xfree

Greg Hudson ghudson at MIT.EDU
Thu Mar 28 15:53:01 EDT 2013


https://github.com/krb5/krb5/commit/cc7cbe70c5b8b3c0abb83c7ec98244e26f1efa65
commit cc7cbe70c5b8b3c0abb83c7ec98244e26f1efa65
Author: Greg Hudson <ghudson at mit.edu>
Date:   Thu Mar 28 15:51:43 2013 -0400

    Get rid of krb5_xfree

 src/include/k5-int.h                          |    3 ---
 src/lib/kdb/kdb5.c                            |    8 ++++----
 src/plugins/kdb/ldap/libkdb_ldap/ldap_misc.c  |   22 +++++++++++-----------
 src/plugins/kdb/ldap/libkdb_ldap/ldap_realm.c |   24 ++++++++++++------------
 4 files changed, 27 insertions(+), 30 deletions(-)

diff --git a/src/include/k5-int.h b/src/include/k5-int.h
index a8c1028..d804047 100644
--- a/src/include/k5-int.h
+++ b/src/include/k5-int.h
@@ -1748,9 +1748,6 @@ krb5int_cc_default(krb5_context, krb5_ccache *);
 /* value to use when requesting a keytab entry and enctype doesn't matter */
 #define IGNORE_ENCTYPE 0
 
-/* to keep lint happy */
-#define krb5_xfree(val) free((char *)(val))
-
 /* To keep happy libraries which are (for now) accessing internal stuff */
 
 /* Make sure to increment by one when changing the struct */
diff --git a/src/lib/kdb/kdb5.c b/src/lib/kdb/kdb5.c
index e1a7c5d..779ce93 100644
--- a/src/lib/kdb/kdb5.c
+++ b/src/lib/kdb/kdb5.c
@@ -72,7 +72,7 @@ free_mkey_list(krb5_context context, krb5_keylist_node *mkey_list)
     for (cur = mkey_list; cur != NULL; cur = next) {
         next = cur->next;
         krb5_free_keyblock_contents(context, &cur->keyblock);
-        krb5_xfree(cur);
+        free(cur);
     }
 }
 
@@ -145,7 +145,7 @@ krb5_dbe_free_key_list(krb5_context context, krb5_keylist_node *val)
         prev = temp;
         temp = temp->next;
         krb5_free_keyblock_contents(context, &(prev->keyblock));
-        krb5_xfree(prev);
+        free(prev);
     }
 }
 
@@ -157,7 +157,7 @@ krb5_dbe_free_actkvno_list(krb5_context context, krb5_actkvno_node *val)
     while (temp != NULL) {
         prev = temp;
         temp = temp->next;
-        krb5_xfree(prev);
+        free(prev);
     }
 }
 
@@ -170,7 +170,7 @@ krb5_dbe_free_mkey_aux_list(krb5_context context, krb5_mkey_aux_node *val)
         prev = temp;
         temp = temp->next;
         krb5_dbe_free_key_data_contents(context, &prev->latest_mkey);
-        krb5_xfree(prev);
+        free(prev);
     }
 }
 
diff --git a/src/plugins/kdb/ldap/libkdb_ldap/ldap_misc.c b/src/plugins/kdb/ldap/libkdb_ldap/ldap_misc.c
index 7659b9b..3fac3c7 100644
--- a/src/plugins/kdb/ldap/libkdb_ldap/ldap_misc.c
+++ b/src/plugins/kdb/ldap/libkdb_ldap/ldap_misc.c
@@ -467,45 +467,45 @@ krb5_ldap_free_server_context_params(krb5_ldap_context *ldap_context)
                     ldap_unbind_ext_s(ldap_server_handle->ldap_handle, NULL, NULL);
                     ldap_server_handle->ldap_handle = NULL;
                     next_ldap_server_handle = ldap_server_handle->next;
-                    krb5_xfree(ldap_server_handle);
+                    free(ldap_server_handle);
                     ldap_server_handle = next_ldap_server_handle;
                 }
             }
-            krb5_xfree(ldap_context->server_info_list[i]);
+            free(ldap_context->server_info_list[i]);
             i++;
         }
-        krb5_xfree(ldap_context->server_info_list);
+        free(ldap_context->server_info_list);
     }
 
     if (ldap_context->conf_section != NULL) {
-        krb5_xfree(ldap_context->conf_section);
+        free(ldap_context->conf_section);
         ldap_context->conf_section = NULL;
     }
 
     if (ldap_context->bind_dn != NULL) {
-        krb5_xfree(ldap_context->bind_dn);
+        free(ldap_context->bind_dn);
         ldap_context->bind_dn = NULL;
     }
 
     if (ldap_context->bind_pwd != NULL) {
         memset(ldap_context->bind_pwd, 0, strlen(ldap_context->bind_pwd));
-        krb5_xfree(ldap_context->bind_pwd);
+        free(ldap_context->bind_pwd);
         ldap_context->bind_pwd = NULL;
     }
 
     if (ldap_context->service_password_file != NULL) {
-        krb5_xfree(ldap_context->service_password_file);
+        free(ldap_context->service_password_file);
         ldap_context->service_password_file = NULL;
     }
 
     if (ldap_context->certificates) {
         i=0;
         while (ldap_context->certificates[i] != NULL) {
-            krb5_xfree(ldap_context->certificates[i]->certificate);
-            krb5_xfree(ldap_context->certificates[i]);
+            free(ldap_context->certificates[i]->certificate);
+            free(ldap_context->certificates[i]);
             ++i;
         }
-        krb5_xfree(ldap_context->certificates);
+        free(ldap_context->certificates);
     }
 
     return(0);
@@ -520,7 +520,7 @@ krb5_ldap_free_server_params(krb5_ldap_context *ldap_context)
     krb5_ldap_free_server_context_params(ldap_context);
 
     k5_mutex_destroy(&ldap_context->hndl_lock);
-    krb5_xfree(ldap_context);
+    free(ldap_context);
     return(0);
 }
 
diff --git a/src/plugins/kdb/ldap/libkdb_ldap/ldap_realm.c b/src/plugins/kdb/ldap/libkdb_ldap/ldap_realm.c
index ad6b7fe..e5c1f59 100644
--- a/src/plugins/kdb/ldap/libkdb_ldap/ldap_realm.c
+++ b/src/plugins/kdb/ldap/libkdb_ldap/ldap_realm.c
@@ -889,39 +889,39 @@ krb5_ldap_free_realm_params(krb5_ldap_realm_params *rparams)
             free(rparams->realmdn);
 
         if (rparams->realm_name)
-            krb5_xfree(rparams->realm_name);
+            free(rparams->realm_name);
 
         if (rparams->subtree) {
             for (i=0; i<rparams->subtreecount && rparams->subtree[i] ; i++)
-                krb5_xfree(rparams->subtree[i]);
-            krb5_xfree(rparams->subtree);
+                free(rparams->subtree[i]);
+            free(rparams->subtree);
         }
 
         if (rparams->kdcservers) {
             for (i=0; rparams->kdcservers[i]; ++i)
-                krb5_xfree(rparams->kdcservers[i]);
-            krb5_xfree(rparams->kdcservers);
+                free(rparams->kdcservers[i]);
+            free(rparams->kdcservers);
         }
 
         if (rparams->adminservers) {
             for (i=0; rparams->adminservers[i]; ++i)
-                krb5_xfree(rparams->adminservers[i]);
-            krb5_xfree(rparams->adminservers);
+                free(rparams->adminservers[i]);
+            free(rparams->adminservers);
         }
 
         if (rparams->passwdservers) {
             for (i=0; rparams->passwdservers[i]; ++i)
-                krb5_xfree(rparams->passwdservers[i]);
-            krb5_xfree(rparams->passwdservers);
+                free(rparams->passwdservers[i]);
+            free(rparams->passwdservers);
         }
 
         if (rparams->tl_data) {
             if (rparams->tl_data->tl_data_contents)
-                krb5_xfree(rparams->tl_data->tl_data_contents);
-            krb5_xfree(rparams->tl_data);
+                free(rparams->tl_data->tl_data_contents);
+            free(rparams->tl_data);
         }
 
-        krb5_xfree(rparams);
+        free(rparams);
     }
     return;
 }


More information about the cvs-krb5 mailing list