Seems to be introduced by 99e5024e97f.
The crash is caused by the difference in the expected alignment
of the uiPopupMenu which is 16 bytes and the actual alignment
returned by the MEM_mallocN() which is 8 bytes due to the memory
head.
Now made it so that MEM_new() can be used for types with any
alignment.