Using valgrind to read this I get: Invalid write/read of size 4
struct Person{ char* name; int age; }; struct Person* create_pers
Because you want to allocate enough space to hold an entire structure, not just a pointer to it.
That is, use sizeof(struct Person) and not sizeof(struct Person*).
sizeof(struct Person)
sizeof(struct Person*)
sizeof(struct Person*)+4 is coincidentally big enough on your platform.
sizeof(struct Person*)+4