From realloc man page:
"If the new size is larger than the old size, the added memory will not be initialized."
|
data = realloc(data, sizeof(struct line_data)*line_data_buf); |
As the first call is to calloc, this might lead to false assumptions when accessing the memory.
A possible solution is to memset the data buffer after realloc.