Skip to content

#3179: a producer's error-path free and the address of a field of its local no longer make it raw - #3196

Merged
ehartford merged 2 commits into
mainfrom
i3179
Nov 9, 2026
Merged

ehartford merged 2 commits into
mainfrom
i3179

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Fixes #3179 (part: the error-path free and the field-address cases). Two commits: fd_callee_retains returns false when the callee destroys that parameter; the ownership walk records f(&p->field) as no store of p. Fixture conan_facade_error_path_free_test. Battery GREEN on f0023b1 (with run tools/battery.w in ~/.local/with-staging/i3179, wall 331 s after a green gate and internals lane; status: GREEN BATTERY_DONE). The walking-destroyer gap the fixture exposed is #3195.

Eric Hartford added 2 commits November 8, 2026 23:48
…roducer's error-path free no longer makes it raw

cJSON_Duplicate_rec and its kind allocate, fill, and on failure pass the
fresh local to the destroyer and return NULL. The destroyer stores its
parameter in a local while it walks, so fd_callee_retains read the sink
as retention and the producer stayed raw ('local newitem is passed to
cJSON_Delete, which retains it'; 24 + 14 functions in the #3116 survey).
A callee whose param_destroys marks the index keeps nothing: destruction
is not retention.

Fixture: conan_facade_error_path_free_test (thing_make frees on the error
path; presented as the owned producer of Thing).
…local's address

The ownership walk recorded any `&`-argument rooted at a local as the
local being stored ('f(&p): the callee may replace or keep the pointer').
`index_tree_append(&i->streams, …)` in xz's lzma_index_init is the
address of a part of what i names; the callee can neither replace nor
keep i, yet the producer stayed raw ('local i is stored or its address
taken'; 40 + 13 functions in the #3116 survey). Only a bare `&p` is
the pointer's address.

Fixture: conan_facade_error_path_free_test's `zero(&t->n)`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant