The alloction size is wrong:
sizeof(entry_t *) is teh size of a pointer, not the size of the ponted value (the structure).
When you are accessing the next1 field of the structure, you are reading data right after the place you have allocated.
I would recommand to use the idiomatic pointer initialization form:
next2=malloc(sizeof(*next2));
It allows to change the pointed type without impact on allocation statement:
You should also test the next2 pointer righ after to check if the allocation worked well.
Additionnaly, you are testing a value which have not been initialized (next2->next1). The value of the field is unpredictable just after allocation.
The most probable here is that the next1 pointer should be initilized to NULL as no memory has been allocated to store an other "struct entry_s".