GetMem(P, sizeof(TMyRec));

results in P, a chunk of allocated memory filled with crap. When you assign a string to this pool of crap you first have to free the old string. If it tries to free Nil then it won't try, but if there's any value but nil, then you are freeing something that isn't allocated

Basically, you need to use either allocmem(it'll zero out the memory), or use fillchar after getmem. They are basically the same

Edit: and I think new uses the same method as allocmem. Eg. zeroes before returning