Workaround regression 11777.

Probably freed memory is used in future and refactoring commit triggered the issue by changing allocation functions.

Issue URL: https://d.puremagic.com/issues/show_bug.cgi?id=11777
Causing commit: 1e99eed73c06ae450c1c13352021e4b629d2bba8
Merge pull request #2990 from denis-sh/workaround-regression-11777

Workaround regression 11777.