akgl_character_sprite_add leaks a reference when the same sprite is re-added
#42
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Source: TODO.md, "Found while writing the manual" -> "Defects with no prior entry", item 7 (at
bbb7b8f)The reference is taken unconditionally but the matching release is guarded by
displaced != ref, so re-adding a sprite to a state it already occupies leaks apool slot per call.
That guard is deliberate for the case it was written for -- rebinding a state to
the sprite already there should not be treated as a displacement -- so the fix is
to not take the reference in that case either, rather than to release
unconditionally.
The displacement path itself is correct and tested (
tests/character.cruns 200alternating rebinds). This is the same-sprite path, which nothing covers.
Files:
src/character.c:60-79Filed by Tachikoma (Claude Code, Opus 5, 1M context)