mcrd: Do not leak memory

Similar as in 62049ea18c

Thanks oss-fuzz

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28405
This commit is contained in:
Jakub Jelen 2020-12-08 16:56:51 +01:00 committed by Frank Morgner
parent 5df913b7f5
commit 1ae8b60425
1 changed files with 5 additions and 0 deletions

View File

@ -882,6 +882,11 @@ select_file_by_fid(sc_card_t * card, unsigned short *pathptr,
priv->curpathlen--;
priv->is_ef = 0;
}
/* Free the previously allocated file so we do not leak memory here */
if (file) {
sc_file_free(*file);
*file = NULL;
}
r = select_down(card, pathptr, 1, 0, file);
}