RT-Thread / RT-Thread/rt-thread

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

Open
#11,724 3 comments 0 reactions 1 assignee View on GitHub

@Huoyanlifusu is already working on this.

Since Sep 5, 2026.

bug in progress
Dominant language
C
Stars
12.2k
Forks
5.4k
Avg merge
4d 12h
Merged PRs (30d)
40

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.