Skip to content

realloc incorrectly frees the old block in the case where malloc fails to allocate a larger block #11

@apmorton

Description

@apmorton

As per ansi spec, realloc is supposed to return null and leave the original pointer in tact in the case of failure if size > 0 and the original pointer was not null.

The code in this repo violates this condition in the OOM case by calling free on the original pointer regardless of whether the call to malloc suceeds

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions