struct_ptr = (my_struct*)malloc(sizeof(my_struct*));

you have to allocate space for your struct. not for the struct pointer.