(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
This commit is contained in:
Love Hörnquist Åstrand
2006-04-07 13:06:37 +00:00
parent 125128ed5c
commit 6b76beb9d8

View File

@@ -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;