card-authentic: Avoid memory leak

Thanks oss-fuzz

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=24013
This commit is contained in:
Jakub Jelen 2020-09-01 19:09:36 +02:00 committed by Jakub Jelen
parent 460a862ee0
commit c07d9ec103

View File

@ -764,8 +764,12 @@ authentic_select_file(struct sc_card *card, const struct sc_path *path,
memmove(&lpath.value[0], &lpath.value[2], lpath.len - 2);
lpath.len -= 2;
if (!lpath.len)
if (lpath.len == 0) {
LOG_FUNC_RETURN(ctx, SC_SUCCESS);
} else if (file_out != NULL) {
sc_file_free(*file_out);
*file_out = NULL;
}
}
if (lpath.type == SC_PATH_TYPE_PATH && (lpath.len == 2))