(kt_remove): Free memory in error handling cases.
authorLove Hörnquist Åstrand <lha@kth.se>
Fri, 7 Apr 2006 13:06:37 +0000 (13:06 +0000)
committerLove Hörnquist Åstrand <lha@kth.se>
Fri, 7 Apr 2006 13:06:37 +0000 (13:06 +0000)
From Coverity NetBSD CID#1886.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17004 ec53bebd-3082-4978-b11e-865c3cabbd6b

admin/remove.c

index 44d19bd6fa851af6d32a5966e3d556afe2903fca..2f6fbdddb1633c99239061664d9384e793e9fa1c 100644 (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;