Avoid memory leaks from file selection

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17106
This commit is contained in:
Jakub Jelen 2019-10-16 11:05:14 +02:00 committed by Frank Morgner
parent 6ef0ac6e67
commit 62049ea18c
1 changed files with 3 additions and 0 deletions

View File

@ -836,6 +836,9 @@ select_file_by_path(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 */
sc_file_free(*file);
*file = NULL;
r = select_down(card, pathptr, pathlen, 0, file);
}
return r;