aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-auth.c
diff options
context:
space:
mode:
authorMagnus Hagander <magnus@hagander.net>2007-07-12 14:10:39 +0000
committerMagnus Hagander <magnus@hagander.net>2007-07-12 14:10:39 +0000
commit67719940585f36617a15dac16a32744a18711ede (patch)
tree0062242a3167714a82601b9ff1c24ed607992b68 /src/interfaces/libpq/fe-auth.c
parent05c4d8f783d57e7ea83fb158e3637908d9f08c28 (diff)
downloadpostgresql-67719940585f36617a15dac16a32744a18711ede.tar.gz
postgresql-67719940585f36617a15dac16a32744a18711ede.zip
Fix freenig of names in Kerberos when using MIT - need to use the
free function provided in the Kerberos library. This fixes a very hard to track down heap corruption on windows when using debug runtimes.
Diffstat (limited to 'src/interfaces/libpq/fe-auth.c')
-rw-r--r--src/interfaces/libpq/fe-auth.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c
index 8e6dca6fb05..f19ef07671d 100644
--- a/src/interfaces/libpq/fe-auth.c
+++ b/src/interfaces/libpq/fe-auth.c
@@ -10,7 +10,7 @@
* exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes).
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.124 2007/07/10 13:14:21 mha Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.125 2007/07/12 14:10:39 mha Exp $
*
*-------------------------------------------------------------------------
*/
@@ -64,6 +64,18 @@
#endif
/*
+ * Heimdal doesn't have a free function for unparsed names. Just pass it to
+ * standard free() which should work in these cases.
+ */
+#ifndef HAVE_KRB5_FREE_UNPARSED_NAME
+static void
+krb5_free_unparsed_name(krb5_context context, char *val)
+{
+ free(val);
+}
+#endif
+
+/*
* pg_an_to_ln -- return the local name corresponding to an authentication
* name
*
@@ -180,8 +192,8 @@ pg_krb5_destroy(struct krb5_info * info)
{
krb5_free_principal(info->pg_krb5_context, info->pg_krb5_client);
krb5_cc_close(info->pg_krb5_context, info->pg_krb5_ccache);
+ krb5_free_unparsed_name(info->pg_krb5_context, info->pg_krb5_name);
krb5_free_context(info->pg_krb5_context);
- free(info->pg_krb5_name);
}