fixed resource reallocation bug, added str_cat

Fixed a bug when calling 'mem_realloc' that lost track of the resource. Added
a 'str_cat' function for concatenating strings.