This is not a direct answer to your question, but you might as well just copy pointers instead of all these malloc
s and strcpy
s:
int i;
if (list != NULL && index < list->size)
{
free(list->array[index]);
for (i=index; i<list->size-1; i++)
list->array[i] = list->array[i+1];
list->size--;
return 1;
}
Or if you don't mind the order of the strings, then even better:
if (list != NULL && index < list->size)
{
free(list->array[index]);
if (index < list->size-1)
list->array[index] = list->array[list->size-1];
list->size--;
return 1;
}