Skip to content

[Bug] sdio_read_cis() 中部分 CIS 元组分支未释放节点,反复 SDIO 初始化/反初始化导致内存泄漏 #11724

Description

@minjiezhong

RT-Thread Version

master(v5.2.2)

Affected area

Other / Not sure

Hardware/BSP vendor

Not applicable / Other

Architecture

Not applicable / Other

Board and hardware details

sdio

Develop Toolchain

RT-Thread Studio

Describe the bug

问题:反复执行 SDIO 初始化 / 反初始化时存在内存泄漏:每次调用 sdio_read_cis() 都会泄漏内存,且之后调用 sdio_free_cis() 也无法回收

原因:在 sdio.c 的 sdio_read_cis() 中,每轮循环都会为一个 CIS 元组分配节点,但在随后的 switch (tpl_code) 中,以下分支既没有 rt_free(curr) ,也没有将 curr 挂入 func->tuples 链表,只有 default 分支会把节点挂入 func->tuples 链表,从而由 sdio_free_cis() 统一释放。

Other additional context

Image Image Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis PR/issue is a bug in the current code.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions