diff options
author | Love Hörnquist Åstrand <lha@kth.se> | 2006-04-07 13:06:37 +0000 |
---|---|---|
committer | Love Hörnquist Åstrand <lha@kth.se> | 2006-04-07 13:06:37 +0000 |
commit | 6b76beb9d83f0dc65d09baf4e93345277999e19e (patch) | |
tree | c9c51b2682646d62d938646f7ba5ef784cd7681c /admin | |
parent | 125128ed5ca86bc748a7b7449b93eb03009deb18 (diff) |
(kt_remove): Free memory in error handling cases.
From Coverity NetBSD CID#1886.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17004 ec53bebd-3082-4978-b11e-865c3cabbd6b
Diffstat (limited to 'admin')
-rw-r--r-- | admin/remove.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/admin/remove.c b/admin/remove.c index 44d19bd6f..2f6fbdddb 100644 --- a/admin/remove.c +++ b/admin/remove.c @@ -69,11 +69,14 @@ kt_remove(struct remove_options *opt, int argc, char **argv) krb5_warnx(context, "You must give at least one of " "principal, enctype or kvno."); - return 1; + ret = EINVAL; + goto out; } - if((keytab = ktutil_open_keytab()) == NULL) - return 1; + if((keytab = ktutil_open_keytab()) == NULL) { + ret = 1; + goto out; + } entry.principal = principal; entry.keyblock.keytype = enctype; @@ -82,6 +85,7 @@ kt_remove(struct remove_options *opt, int argc, char **argv) krb5_kt_close(context, keytab); if(ret) krb5_warn(context, ret, "remove"); + out: if(principal) krb5_free_principal(context, principal); return ret != 0; |