Skip to content

Facade proof: a destroyer that frees its parameter through a walking local (cJSON_Delete: cur = item; while (cur) { next = cur->next; free(cur); cur = next; }) is not seen destroying it #3195

Closed

Description

@ehartford

Part of #3115; found writing the #3179 fixture. A destroyer of this shape

void thing_free(Thing *t) { Thing *cur = t; while (cur) { Thing *next = cur->next; free(cur); cur = next; } }

gets no param_destroys mark: the parameter is copied into a local and the local is freed, so the record has "1 producer(s) and no unary destroyer in the package; a registry fact names the drop", and every producer of it is raw. cJSON_Delete, libxml2's list frees and most linked-structure destroyers are written this way. The proof should follow a parameter into a local assigned from it (localsrc:cur:param:0, then cur = next from a field of cur) and count free(cur) on the first iteration as destroying the parameter. The sibling case for returns (fd_local_verdict) already follows localsrc.

Activity

  1. added
    bug
    on Nov 9, 2026
  2. added 2 commits that reference this issue on Nov 9, 2026
  3. ehartford commented on Nov 9, 2026

    @ehartford
    ContributorAuthor

    Fixed in #3197 (main 6d478f1): a local that walks from the parameter stands for it at the first destroying sink; a for statement's increment is recorded after its body. Fixture conan_facade_walking_destroyer_test (a while walk, a for walk, and an advance-then-free that must not count).

  4. added a commit that references this issue on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions