From c5dd980dba125cf909f719ec63923782e17bf7e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Mon, 10 Apr 2006 09:48:42 +0000 Subject: [PATCH] (krb5_rc_resolve_full): don't return pointer to a allocated krb5_rcache in case of error. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17039 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/replay.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/krb5/replay.c b/lib/krb5/replay.c index 4e499b024..41d6a3e41 100644 --- a/lib/krb5/replay.c +++ b/lib/krb5/replay.c @@ -58,6 +58,7 @@ krb5_rc_resolve_type(krb5_context context, krb5_rcache *id, const char *type) { + *id = NULL; if(strcmp(type, "FILE")) { krb5_set_error_string (context, "replay cache type %s not supported", type); @@ -77,6 +78,9 @@ krb5_rc_resolve_full(krb5_context context, const char *string_name) { krb5_error_code ret; + + *id = NULL; + if(strncmp(string_name, "FILE:", 5)) { krb5_set_error_string (context, "replay cache type %s not supported", string_name); @@ -86,6 +90,10 @@ krb5_rc_resolve_full(krb5_context context, if(ret) return ret; ret = krb5_rc_resolve(context, *id, string_name + 5); + if (ret) { + krb5_rc_close(id); + *id = NULL; + } return ret; }