Fixed #389: Providing negative value to memory allocation function.
Merge pull request #233 from orbitcowboy/master

Fixed #389: Providing negative value to memory allocation function.