/* Default to a hidden visibility for all portability functions. */
#pragma GCC visibility push(hidden)
-/* MIT-specific. The Heimdal documentation says to use free(). */
+/*
+ * MIT-specific. The Heimdal documentation says to use free(), but that
+ * doesn't actually make sense since the memory is allocated inside the
+ * Kerberos library. Use krb5_xfree instead.
+ */
#ifndef HAVE_KRB5_FREE_DEFAULT_REALM
-# define krb5_free_default_realm(c, r) free(r)
+# define krb5_free_default_realm(c, r) krb5_xfree(r)
#endif
/*
* Heimdal: krb5_xfree, MIT: krb5_free_string, older MIT uses free(). Note
* that we can incorrectly allocate in the library and call free() if
* krb5_free_string is not available but something we use that API for is
- * available. Hopefully that won't happen.
+ * available, such as krb5_appdefaults_*, but there isn't anything we can
+ * really do about it.
*/
#ifndef HAVE_KRB5_FREE_STRING
# ifdef HAVE_KRB5_XFREE