Skip to main content

Practice · 1 of 4

Ownership Ledger

CHALLENGE
Difficulty: advanced+25 XP

An allocation ledger lives in your editor (struct ent { const void *p; int freed; }; static struct ent ledger[16]; static size_t n_led;). Implement void own(const void *p) (record), void release(const void *p) (mark freed; double-release must be detectable), and int audit(void) returning the count of leaked (never freed) entries — the shutdown check LSan performs.

Back to lesson: Practice: Detection Drills