Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mchalupa opened this issue Oct 7, 2020 · 0 comments
Open

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

mchalupa opened this issue Oct 7, 2020 · 0 comments
Labels

Comments

@mchalupa
Copy link
Member

mchalupa commented Oct 7, 2020

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 mchalupa/dg#345.

@mchalupa mchalupa added the bug label Oct 7, 2020
@mchalupa mchalupa changed the title Missed memory leak when a part of a pointer is overwritten Missed memory leak when only a part of the pointer is overwritten Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant