Skip to content

Repeated mallocs/frees causing segfault #4

Description

@jdetter

This test passes on Linux, however causes a segfault in Chronos. Reproducer program (malloc test in testsuite):

#include <stdlib.h>
#include <testsuite.h>

#define COUNT 0x10000
#define ALLOC_SIZE 0x1000

int main(int argc, char** argv)
{
    int* arr[COUNT];
    int x;
    for(x = 0;x < COUNT;x++)
    {
        arr[x] = malloc(ALLOC_SIZE);
        if(!arr[x])
            TESTFAILURE;
    }

    for(x = 0;x < COUNT;x++)
        free(arr[x]);

    for(x = 0;x < COUNT;x++)
    {
        arr[x] = malloc(ALLOC_SIZE);
        if(!arr[x])
            TESTFAILURE;
    }

    for(x = 0;x < COUNT;x++)
        free(arr[x]);

    TESTSUCCESS;

    return 0;
}

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

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions