From: Ken Raeburn Date: Mon, 17 Nov 2008 21:28:04 +0000 (+0000) Subject: Fix a memory management bug X-Git-Tag: krb5-1.7-alpha1~202 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=35512dc03374b199afb6d5f5cb1e399aee63d60e;p=krb5.git Fix a memory management bug git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21133 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/kdb/kdb_convert.c b/src/lib/kdb/kdb_convert.c index 3846cba27..48858835a 100644 --- a/src/lib/kdb/kdb_convert.c +++ b/src/lib/kdb/kdb_convert.c @@ -285,10 +285,12 @@ conv_princ_2db(krb5_context context, krb5_principal *dbprinc, free(princ->data[i].data); princ->data[i].data = NULL; } - } else + } else { princ->data = NULL; + princ->length = 0; + } princ->data = (krb5_data *)realloc(princ->data, - (princ->length * sizeof (krb5_data))); + (kdbe_princ->k_components.k_components_len * sizeof (krb5_data))); if (princ->data == NULL) /* XXX Memory leak: old storage not freed. */ goto error;