The following is a common code pattern
Resource resource = GetResource();
DoWork();
return resource;
If DoWork() throws exception, the resource will be leaked. We need to guard against this.
For example
bool success = false;
try
{
success = true;
}
finally
if (!success)
DisposeResource(resource);