pkcs15: fixed resource leak

This commit is contained in:
Frank Morgner 2015-04-29 23:22:27 +02:00 committed by Viktor Tarasov
parent c7afbb4ca2
commit 9263da49aa
1 changed files with 7 additions and 2 deletions

View File

@ -911,14 +911,19 @@ sc_dup_app_info(const struct sc_app_info *info)
if (info->label) {
out->label = strdup(info->label);
if (!out->label)
if (!out->label) {
free(out);
return NULL;
}
} else
out->label = NULL;
out->ddo.value = malloc(info->ddo.len);
if (!out->ddo.value)
if (!out->ddo.value) {
free(out->label);
free(out);
return NULL;
}
memcpy(out->ddo.value, info->ddo.value, info->ddo.len);
return out;