fixed memory leaks
This commit is contained in:
parent
83c4ebe9d6
commit
893be0d9c0
|
@ -367,8 +367,11 @@ static int mcrd_init(sc_card_t * card)
|
|||
|
||||
sc_format_path ("3f00", &tmppath);
|
||||
r = sc_select_file (card, &tmppath, NULL);
|
||||
if (r < 0)
|
||||
if (r < 0) {
|
||||
free(card->drv_data);
|
||||
card->drv_data = NULL;
|
||||
r = SC_ERROR_INVALID_CARD;
|
||||
}
|
||||
|
||||
/* Not needed for the fixed EstEID profile */
|
||||
if (!is_esteid_card(card))
|
||||
|
|
|
@ -1091,13 +1091,16 @@ piv_get_cached_data(sc_card_t * card, int enumtag, u8 **buf, size_t *buf_len)
|
|||
priv->obj_cache[enumtag].internal_obj_data,
|
||||
priv->obj_cache[enumtag].internal_obj_len);
|
||||
|
||||
} else if (r == 0 || r == SC_ERROR_FILE_NOT_FOUND) {
|
||||
} else {
|
||||
free(rbuf);
|
||||
if (r == 0 || r == SC_ERROR_FILE_NOT_FOUND) {
|
||||
r = SC_ERROR_FILE_NOT_FOUND;
|
||||
priv->obj_cache[enumtag].flags |= PIV_OBJ_CACHE_VALID;
|
||||
priv->obj_cache[enumtag].obj_len = 0;
|
||||
} else if ( r < 0) {
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
ok:
|
||||
|
||||
err:
|
||||
|
|
Loading…
Reference in New Issue