Fixes an issue with post instance data preparation. Currently, there is
no way to check if event data has really been set during handler
execution preparation. When data is not allocated from the heap, user
could have passed 0x0 which can lead to failed checks.
This also implements using the already allocated data memory for posting
events from non-ISR functions when data size is less than the capacity.