From: Ken Raeburn Date: Fri, 18 Jun 1999 22:51:40 +0000 (+0000) Subject: * init_ctx.c (krb5_free_context): Set field pointers to NULL after freeing X-Git-Tag: krb5-1.1-beta1~94 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e9a929d3fe5985ba2aaaf54da62021a8f6ae364a;p=krb5.git * init_ctx.c (krb5_free_context): Set field pointers to NULL after freeing targets, in case higher-level code retains pointers into the context structure. From Jeffrey Altman. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11523 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/krb/ChangeLog b/src/lib/krb5/krb/ChangeLog index b798f3c94..77a101ed0 100644 --- a/src/lib/krb5/krb/ChangeLog +++ b/src/lib/krb5/krb/ChangeLog @@ -1,3 +1,9 @@ +1999-06-18 Ken Raeburn + + * init_ctx.c (krb5_free_context): Set field pointers to NULL after + freeing targets, in case higher-level code retains pointers into + the context structure. (From Jeffrey Altman.) + Thu May 13 17:31:34 1999 Theodore Y. Ts'o * init_ctx.c (krb5_init_context): Pass the context to diff --git a/src/lib/krb5/krb/init_ctx.c b/src/lib/krb5/krb/init_ctx.c index a61bf708e..2d8759241 100644 --- a/src/lib/krb5/krb/init_ctx.c +++ b/src/lib/krb5/krb/init_ctx.c @@ -184,17 +184,25 @@ krb5_free_context(ctx) krb5_free_ets(ctx); krb5_os_free_context(ctx); - if (ctx->in_tkt_ktypes) + if (ctx->in_tkt_ktypes) { free(ctx->in_tkt_ktypes); + ctx->in_tkt_ktypes = 0; + } - if (ctx->tgs_ktypes) + if (ctx->tgs_ktypes) { free(ctx->tgs_ktypes); + ctx->tgs_ktypes = 0; + } - if (ctx->default_realm) + if (ctx->default_realm) { free(ctx->default_realm); + ctx->default_realm = 0; + } - if (ctx->ser_ctx_count && ctx->ser_ctx) - free(ctx->ser_ctx); + if (ctx->ser_ctx_count && ctx->ser_ctx) { + free(ctx->ser_ctx); + ctx->ser_ctx = 0; + } ctx->magic = 0; free(ctx);