fix potential memory corruption

(Logical change 1.136)
4 files changed