uninitialized-dealloc-auditor

uninitialized-dealloc-auditor is an agent for coding agents from ReviewToolkits/cpython-review-toolkit. It costs 196 tokens per session (2,688 once invoked), scanned A, original, MIT.

A checker for CPython constructors that may release partly built objects unsafely. CPython is the main implementation of Python, and these objects can contain uninitialized pointers if construction fails.

In plain words
What is it for?
Use it to inspect constructors for missing early initialization before a fallible operation. It looks at cleanup through deallocation and clearing functions and requires tree-sitter for its assisted analysis.
Why use it?
It helps find crash risks during low-memory conditions, when cleanup may read garbage member pointers. This is especially relevant to C code using allocators that do not clear new memory.

Agent

Part of the cpython-review-toolkit plugin — 7 commands, 23 agents shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/reviewtoolkits/cpython-review-toolkit/uninitialized-dealloc-auditor
Clone the repo
git clone --depth 1 https://github.com/ReviewToolkits/cpython-review-toolkit

Or install cpython-review-toolkit, the plugin that ships this one along with the rest of its 7 commands, 23 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for uninitialized-dealloc-auditor

README.md
[![agentmods](https://agentmods.dev/badge/agents/reviewtoolkits/cpython-review-toolkit/uninitialized-dealloc-auditor.svg)](https://agentmods.dev/agents/reviewtoolkits/cpython-review-toolkit/uninitialized-dealloc-auditor)
Your own site
<a href="https://agentmods.dev/agents/reviewtoolkits/cpython-review-toolkit/uninitialized-dealloc-auditor"><img src="https://agentmods.dev/badge/agents/reviewtoolkits/cpython-review-toolkit/uninitialized-dealloc-auditor.svg" alt="Measured on agentmods" height="20"></a>
Per session 196 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,688 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00196 $0.02688
Opus 5 $0.00098 $0.01344
Sonnet 5 $0.00039 $0.00538
Haiku 4.5 $0.00020 $0.00269

Measured 4d ago against content hash 0ea8c5ca3e36, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

uninitialized-dealloc-auditor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/cpython-review-toolkit/agents/uninitialized-dealloc-auditor.md · 93 lines

How it starts

The opening of the file, as written. The whole thing — 93 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are an expert in CPython object construction and teardown. Your mission is to find constructors that can free a half-initialized object, so its tp_dealloc / tp_clear reads uninitialized (garbage) member pointers and crashes.

Why this matters

PyObject_New / PyObject_GC_New / PyObject_NewVar allocate an object but do not zero its type-specific fields — those hold garbage until the constructor assigns them. A correct constructor NULL-initializes members (or memsets the object) before any fallible step. A buggy one performs a fallible call first and, on failure, Py_DECREFs the object — running tp_dealloc/tp_clear, which Py_XDECREFs member pointers that are still garbage. This is the dominant reachable-from-Python crash surface under out-of-memory. Confirmed: odictiter_new (Objects/odictobject.c:1945 — reproduced, K=1 OOM sweep ⇒ SIGABRT), PyList_New (Objects/listobject.c:250, free-threaded build), template_iter (gh-151815), blake2 .copy() with an uninitialized impl enum (gh-152851).

Scope

Analyze the scope provided. Default: the entire project. Requires tree-sitter (pip install tree-sitter tree-sitter-c).

Script-Assisted Analysis

python <plugin_root>/scripts/scan_uninit_dealloc.py [scope]

The scanner's predicate is "is a member written after the free and not also on a path that dominates it" — not "is there a = NULL somewhere before the free". Dominance is AST-based, so a write in one if / else / switch / loop arm does not excuse a free in a sibling arm. Preprocessor conditionals are treated per build configuration: a write in a plain #ifdef X … #endif block does dominate a later free outside it; only a different arm of the same group breaks dominance.

Reported members are further filtered to ones the file's destructor actually cares about, and that filter sets the confidence:

confidence destructor_evidence[m].kind meaning
medium pointer the file does Py_CLEAR / Py_XDECREF / Py_VISIT on x->m — garbage there is a wild decref
low destructor_read a destructor-shaped function merely reads x->m while tearing down other members — a scalar discriminator or loop bound (the blake2 impl shape)

Read the full file on GitHub · 93 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 93 lines · 0 tokens per session scan A 0ea8c5ca3e36

Subscribe to this mod's changes

uninitialized-dealloc-auditor is an agent published in the GitHub repository ReviewToolkits/cpython-review-toolkit (10 stars, last pushed 1mo ago), licensed MIT. It adds 196 tokens to every session and 2,688 once invoked, about $0.0010 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.