Fixed some potential memory leaks in C version
Fixed leaks & Fixed RIGHT

Fixed some memory leaks in the C runtime
- Fixed bug in RIGHT() and LEFT() which would give empty strings when
number of characters requested was greater than the size of the string
passed