Q: Invalid next size with realloc function I have a dynamic structure and I'm trying to do a realloc to save new information on it, but when I tried to do it, it doesn't work...
I got this structure:
typedef struct {
    short int tipo;
    short int gravedad;
    char *mensaje;
    char *proceso;
    short int hora;
    short int min;
    short int seg;
}Info;

typedef struct {
    Info * info;
    int lenght;
}Logs;

I do a malloc in the main.c:
logs.info = (Info*) malloc (sizeof(Info*));

and this is the part where I'm trying the realloc():
#define CHAR_1 1
...
read(fd, &c, CHAR_1);
if (c == '\n') {
    l->lenght++;
    int size = (l->lenght)+1;
    l->info = (Info *) realloc (l->info, sizeof(Info*)*size);
}

The first time l->lenght is 0.
The compiler says:
realloc(): invalid next size 
Aborted (core dumped)

Thanks!
