--- In [email protected], Ravi Mishra <ravics...@...> wrote:
>
> Thanks .. Actually why I am saying realloc can create the problem because
> realloc will allocate the memory at any place of the memory chunks . It may
> be possible if lots of user will allocate the memory and free the memory
> then it may be possible to corruption of memory(i am in
> thinking performance wise.)

It is extremely unlikely that there is a bug in realloc() - if it does what you 
want, then use it.

The only thing you might want to do is check whether it couldn't allocate the 
requested amount of memory and returned NULL. That is:

    list->a = realloc(list->a, (list->n + 1) * sizeof list->a[0]);

    if (!list->a)
    {
        printf("out of memory\n");
        exit(EXIT_FAILURE);
    }

Reply via email to