I got a comment to my answer on this thread:
Malloc inside a function call appears to be getting freed on return?
In short I had code like this:
Well, I think it's the exact opposite - always directly cast it to the needed type. Read on here!