Assign result to var before freeing memory

This patches a segfault occurring when trying to run newCharStringWithCString on searchLocation->data.