pkcs15-tool.c: fixed potential resource leak

This commit is contained in:
Frank Morgner 2015-11-01 10:44:24 +01:00
parent 5399c264fb
commit 4ca7daf31c
1 changed files with 3 additions and 1 deletions

View File

@ -828,8 +828,10 @@ static void print_ssh_key(FILE *outf, const char * alg, struct sc_pkcs15_object
// Old style openssh - [<quote protected options> <whitespace> <keytype> <whitespace> <key> [<whitespace> anything else]
//
r = sc_base64_encode(buf, len, uu, 2*len, 0);
if (r < 0)
if (r < 0) {
free(uu);
return;
}
if (obj->label[0] != '\0')
fprintf(outf,"ssh-%s %s %.*s\n", alg, uu, (int) sizeof obj->label, obj->label);