(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:
@@ -69,11 +69,14 @@ kt_remove(struct remove_options *opt, int argc, char **argv)
|
|||||||
krb5_warnx(context,
|
krb5_warnx(context,
|
||||||
"You must give at least one of "
|
"You must give at least one of "
|
||||||
"principal, enctype or kvno.");
|
"principal, enctype or kvno.");
|
||||||
return 1;
|
ret = EINVAL;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((keytab = ktutil_open_keytab()) == NULL)
|
if((keytab = ktutil_open_keytab()) == NULL) {
|
||||||
return 1;
|
ret = 1;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
entry.principal = principal;
|
entry.principal = principal;
|
||||||
entry.keyblock.keytype = enctype;
|
entry.keyblock.keytype = enctype;
|
||||||
@@ -82,6 +85,7 @@ kt_remove(struct remove_options *opt, int argc, char **argv)
|
|||||||
krb5_kt_close(context, keytab);
|
krb5_kt_close(context, keytab);
|
||||||
if(ret)
|
if(ret)
|
||||||
krb5_warn(context, ret, "remove");
|
krb5_warn(context, ret, "remove");
|
||||||
|
out:
|
||||||
if(principal)
|
if(principal)
|
||||||
krb5_free_principal(context, principal);
|
krb5_free_principal(context, principal);
|
||||||
return ret != 0;
|
return ret != 0;
|
||||||
|
Reference in New Issue
Block a user