Fix a leak when canceling a network operation