From: Ezra Peisach Date: Mon, 12 Feb 2007 00:19:47 +0000 (+0000) Subject: In the resolve function - ensure on memory allocation error - X-Git-Tag: krb5-1.7-alpha1~1291 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=59bbb3cb71c638559c973fd0d4343a7b4bb8cc51;p=krb5.git In the resolve function - ensure on memory allocation error - deref of null pointer does not happen. Also include kt-int.h for prototypes. ticket: 5411 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19153 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/keytab/kt_memory.c b/src/lib/krb5/keytab/kt_memory.c index 044cb1f3b..e103e7685 100644 --- a/src/lib/krb5/keytab/kt_memory.c +++ b/src/lib/krb5/keytab/kt_memory.c @@ -25,6 +25,7 @@ */ #include "k5-int.h" +#include "kt-int.h" #include #define HEIMDAL_COMPATIBLE @@ -200,7 +201,7 @@ void krb5int_mkt_finalize(void) { krb5_error_code KRB5_CALLCONV krb5_mkt_resolve(krb5_context context, const char *name, krb5_keytab *id) { - krb5_mkt_data *data; + krb5_mkt_data *data = 0; krb5_mkt_list_node *list; krb5_error_code err = 0; @@ -275,9 +276,11 @@ krb5_mkt_resolve(krb5_context context, const char *name, krb5_keytab *id) err = KTLOCK(*id); if (err) { k5_mutex_destroy(&data->lock); - krb5_xfree(data->name); + if (data && data->name) + krb5_xfree(data->name); krb5_xfree(data); - krb5_xfree(list->keytab); + if (list && list->keytab) + krb5_xfree(list->keytab); krb5_xfree(list); } else { KTREFCNT(*id)++;