Skip to content

Commit 6a824f5

Browse files
committed
tools: tweak previous
1 parent ed6cadd commit 6a824f5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tools/credman.c

+5-4
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ print_rk(const fido_credman_rk_t *rk, size_t idx)
119119
char *user_id = NULL;
120120
const char *type;
121121
const char *prot;
122+
int r = -1;
122123

123124
if ((cred = fido_credman_rk(rk, idx)) == NULL) {
124125
warnx("fido_credman_rk");
@@ -127,10 +128,8 @@ print_rk(const fido_credman_rk_t *rk, size_t idx)
127128
if (base64_encode(fido_cred_id_ptr(cred), fido_cred_id_len(cred),
128129
&id) < 0 || base64_encode(fido_cred_user_id_ptr(cred),
129130
fido_cred_user_id_len(cred), &user_id) < 0) {
130-
free(user_id);
131-
free(id);
132131
warnx("output error");
133-
return -1;
132+
goto out;
134133
}
135134

136135
type = cose_string(fido_cred_type(cred));
@@ -139,10 +138,12 @@ print_rk(const fido_credman_rk_t *rk, size_t idx)
139138
printf("%02u: %s %s %s %s %s\n", (unsigned)idx, id,
140139
fido_cred_display_name(cred), user_id, type, prot);
141140

141+
r = 0;
142+
out:
142143
free(user_id);
143144
free(id);
144145

145-
return 0;
146+
return r;
146147
}
147148

148149
int

0 commit comments

Comments
 (0)