symbiotic icon indicating copy to clipboard operation
symbiotic copied to clipboard

Missed memory leak when only a part of the pointer is overwritten

Open mchalupa opened this issue 3 years ago • 0 comments

This code has a memory leak as the a[1] = 20 overwrites the pointer to the malloced memory.

int main() {
    void *p = malloc(3U);
    char *a = (char*) p;
    a[1] = 20;
    return 1;
}

The problem is that instrumentation does not mark this overwrite as important and it gets sliced away, see https://github.com/mchalupa/dg/issues/345.

mchalupa avatar Oct 07 '20 07:10 mchalupa