kswitch: memory leaks

ids and name must be freed before they go out of scope.

Change-Id: I0133c27994f7dc2832cea6b8529c060ed779c2ab
This commit is contained in:
Jeffrey Altman
2016-11-18 22:51:59 -05:00
parent d4622f12e5
commit 26dd1edaa9

View File

@@ -123,12 +123,13 @@ kswitch(struct kswitch_options *opt, int argc, char **argv)
id = ids[i - 1];
ids[i - 1] = NULL;
free(name);
} else
krb5_errx(heimtools_context, 1, "No cache selected");
for (i = 0; i < len; i++)
if (ids[i])
krb5_cc_close(heimtools_context, ids[i]);
free(ids);
} else if (opt->principal_string) {
krb5_principal p;