Skip to content

DoubleRelease fallback counters: successive values and exclusive releases are conflated #277

Open

Description

@SizzleUnrlsd

Problem

The DoubleRelease counters count releases and acquisitions per variable and per summary effect,
not per value and not per path. Two shapes keep producing false positives:

A variable released, given an unrelated pointer, then released again.

// resource-model: models/resource-lifetime/generic.txt
#include <stdlib.h>
extern void* unknown_ptr(void);

void reassign_unknown(void)
{
    char* p = malloc(8);
    free(p);
    p = unknown_ptr();   /* not a modeled acquire */
    free(p);             /* reported: potential double release */
}

This is pattern 2 of the #104 comment of 2026-10-26 in its DoubleRelease form; the
UseAfterRelease form was fixed by #270. The sudo plugins/sudoers/editor.c:166 shape from the
same comment (value from an unmodeled source, moved into an array, local set to NULL, released
at a cleanup label) reaches the same counters through the "released without a matching acquire"
check.

Two parameters of one call that release the same pointer on exclusive paths.

static void release_one(void* a, void* b, int c)
{
    if (c)
        free(a);
    else
        free(b);
}

void release_one_same_pointer(int c)
{
    char* p = malloc(8);
    release_one(p, p, c); /* reported: potential double release */
}

The counters add the two summary releases of release_one. The ownership engine's
per-parameter summaries do not know that the two releases exclude each other either: the same
call also gets a MissingRelease ("may leave the function").

Context

Goal

Decide what replaces the counters where the engine has no verdict, then remove them: a per-value
fallback, an engine check for "release of a location holding no owned resource", or both.

Acceptance

Part of #104.

Activity

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

    FPbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions