Skip to content

Static analyzer warning about memory allocation in cpPolyline #203

@richardgroves

Description

@richardgroves

Line 247 of cpPolyline -

set->lines = (cpPolyline**) cpcalloc(set->capacity, sizeof(cpPolyline));

is allocating an array of size cpPolyline objects and assigning it to a cpPolyline** - should the sizeof be sizeof(cpPolyline*) ?

XCode analyzer complains:

Screenshot 2021-02-17 at 16 46 15

Also has the same problem with

set->lines = (cpPolyline**) cprealloc(set->lines, set->capacity*sizeof(cpPolyline));

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