In C I like to use anonymous arrays via void pointers, but when debugging some memory corruption happened. When I use valgrind it is spamming the mentioned message.
Honestly I have no idea what to try since this is a kinda exotic situation.
struct list_t {
void* first;
void** elements;
void* last;
unsigned int max_number_of_elements;
unsigned int number_of_elements;
unsigned int counter;
void* element_current;
};
typedef struct list_t list;
typedef list* List;
List list_create(
) {
List list = malloc(sizeof(list));
list->elements = (void**)malloc(sizeof(void*) * 16 );
...
return list;
}
PS: Why was this marked as a duplicate since there is no clear answer on any even remotely related questions to this one?