mirror of
https://github.com/apache/nuttx.git
synced 2026-02-05 19:56:43 +08:00
crypto: remove release process in close
The callback parameters are currently passed in by the upper layer, so the release process in close should not be performed here. This prevents double-free issues and ensures proper resource management. Signed-off-by: makejian <makejian@xiaomi.com>
This commit is contained in:
@@ -872,8 +872,6 @@ static int cryptof_close(FAR struct file *filep)
|
||||
{
|
||||
FAR struct fcrypt *fcr = filep->f_priv;
|
||||
FAR struct csession *cse;
|
||||
FAR struct cryptkop *krp;
|
||||
int i;
|
||||
|
||||
while ((cse = TAILQ_FIRST(&fcr->csessions)))
|
||||
{
|
||||
@@ -881,22 +879,6 @@ static int cryptof_close(FAR struct file *filep)
|
||||
(void)csefree(cse);
|
||||
}
|
||||
|
||||
while ((krp = TAILQ_FIRST(&fcr->crpk_ret)))
|
||||
{
|
||||
TAILQ_REMOVE(&fcr->crpk_ret, krp, krp_next);
|
||||
for (i = 0; i < CRK_MAXPARAM; i++)
|
||||
{
|
||||
if (krp->krp_param[i].crp_p)
|
||||
{
|
||||
explicit_bzero(krp->krp_param[i].crp_p,
|
||||
(krp->krp_param[i].crp_nbits + 7) / 8);
|
||||
kmm_free(krp->krp_param[i].crp_p);
|
||||
}
|
||||
}
|
||||
|
||||
kmm_free(krp);
|
||||
}
|
||||
|
||||
kmm_free(fcr);
|
||||
filep->f_priv = NULL;
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user