Summary When running _testembed under LeakSanitizer, test_initconfig_get_api reports a memory leak.
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Bug report
Bug description:
Summary
When running _testembed under LeakSanitizer,
test_initconfig_get_api reports a memory leak.
Reproducer
Build CPython with sanitizers:
./configure \
--with-pydebug \
--with-address-sanitizer \
--with-undefined-behavior-sanitizer
make -j
Run the specific test:
ASAN_OPTIONS=detect_leaks=1 \
./Programs/_testembed test_initconfig_get_api
Observed result
LeakSanitizer reports:
ERROR: LeakSanitizer: detected memory leaks
Direct leak of 1 byte(s) in 1 object(s) allocated from:
#0 malloc
#1 PyInitConfig_GetStrList Python/initconfig.c:4024
#2 test_initconfig_get_api Programs/_testembed.c:1844
Root cause
In test_initconfig_get_api:
- The initial call to
PyInitConfig_GetStrList(config, "xoptions", &length, &items)
returns an empty list (length == 0).
- The returned items buffer was not freed.
- The PyInitConfig *config created by PyInitConfig_Create() was not released before returning.
Under LeakSanitizer, this results in a small direct leak and indirect leaks associated with the configuration lifetime.
Environment
-
Architecture: aarch64-linux-gnu
-
Built with: --with-address-sanitizer
-
Leak detected via: ASAN_OPTIONS=detect_leaks=1
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
- gh-145206
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Programs/_testembed.c の test_initconfig_get_api から始め、レポートに記載されている PyInitConfig_GetStrList の結果と設定の有効期間を確認します。提供されている sanitizer ビルドと ./Programs/_testembed test_initconfig_get_api を実行します。LeakSanitizer が設定の直接的なリークまたは関連するリークを報告せずにテストが完了すれば、完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- c, python
- 領域
- testing
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 25/100