Properly realloc array.