Updated file to contain function definitions and free memory allocated to string in test function.