Updating `strip` function.

Adding check for null pointer if memory is not available.

Also, freeing returned stripped strings in tests.