pkcs15-init: fixed resource leak

This commit is contained in:
Frank Morgner 2015-04-29 23:22:30 +02:00 committed by Viktor Tarasov
parent a83da8a947
commit 1f16f24052
1 changed files with 4 additions and 1 deletions

View File

@ -1798,8 +1798,11 @@ get_pin_callback(struct sc_profile *profile,
allocated = 1;
}
if (len > *pinsize)
if (len > *pinsize) {
if (allocated)
free(secret);
return SC_ERROR_BUFFER_TOO_SMALL;
}
memcpy(pinbuf, secret, len + 1);
*pinsize = len;
if (allocated)