From: Ben Kaduk Date: Tue, 14 Apr 2015 19:33:20 +0000 (-0400) Subject: Fix leash crash found in some build environments X-Git-Tag: krb5-1.14-alpha1~128 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ebeb1e359fa10ea710d467ca3756ababd1276fa6;p=thirdparty%2Fkrb5.git Fix leash crash found in some build environments When freeing a credentials cache name obtained from krb5_cc_get_full_name(), the code was using plain free() instead of the matching krb5_free_string(). If these routines are picked from different modules at runtime, the mismatch will cause a crash in free(), so change to using the matched deallocation function. In order to use it in leash, it must be declared in Lglobals.h and the function pointer symbol defined in Leash.cpp. --- diff --git a/src/windows/leash/KrbListTickets.cpp b/src/windows/leash/KrbListTickets.cpp index 63ce046207..beab0ea113 100644 --- a/src/windows/leash/KrbListTickets.cpp +++ b/src/windows/leash/KrbListTickets.cpp @@ -27,7 +27,7 @@ LeashKRB5FreeTicketInfo(TICKETINFO *ticketinfo) ticketinfo->principal = NULL; } if (ticketinfo->ccache_name) { - free(ticketinfo->ccache_name); + pkrb5_free_string(NULL, ticketinfo->ccache_name); ticketinfo->ccache_name = NULL; } if (ticketinfo->ticket_list) diff --git a/src/windows/leash/Leash.cpp b/src/windows/leash/Leash.cpp index 6153499f96..beead0ce25 100644 --- a/src/windows/leash/Leash.cpp +++ b/src/windows/leash/Leash.cpp @@ -693,6 +693,7 @@ DECL_FUNC_PTR(krb5_get_renewed_creds); DECL_FUNC_PTR(krb5_cc_initialize); DECL_FUNC_PTR(krb5_cc_store_cred); DECL_FUNC_PTR(krb5_cc_get_full_name); +DECL_FUNC_PTR(krb5_free_string); DECL_FUNC_PTR(krb5_enctype_to_name); DECL_FUNC_PTR(krb5_cc_get_type); DECL_FUNC_PTR(krb5int_cc_user_set_default_name); @@ -736,6 +737,7 @@ FUNC_INFO krb5_fi[] = { MAKE_FUNC_INFO(krb5_cc_initialize), MAKE_FUNC_INFO(krb5_cc_store_cred), MAKE_FUNC_INFO(krb5_cc_get_full_name), + MAKE_FUNC_INFO(krb5_free_string), MAKE_FUNC_INFO(krb5_enctype_to_name), MAKE_FUNC_INFO(krb5_cc_get_type), MAKE_FUNC_INFO(krb5int_cc_user_set_default_name), diff --git a/src/windows/leash/Lglobals.h b/src/windows/leash/Lglobals.h index 87fdd09935..7141d79e0b 100644 --- a/src/windows/leash/Lglobals.h +++ b/src/windows/leash/Lglobals.h @@ -181,6 +181,7 @@ extern DECL_FUNC_PTR(krb5_get_renewed_creds); extern DECL_FUNC_PTR(krb5_cc_initialize); extern DECL_FUNC_PTR(krb5_cc_store_cred); extern DECL_FUNC_PTR(krb5_cc_get_full_name); +extern DECL_FUNC_PTR(krb5_free_string); extern DECL_FUNC_PTR(krb5_enctype_to_name); extern DECL_FUNC_PTR(krb5_cc_get_type); extern DECL_FUNC_PTR(krb5int_cc_user_set_default_name);