If GetControllerTypeInternal falls back to creating an instance, it should also release it (#8196)

This commit is contained in:
Steve Megson
2020-05-29 13:39:14 +01:00
committed by GitHub
parent 180b858ff5
commit 33850b13d0
2 changed files with 8 additions and 2 deletions
@@ -25,7 +25,10 @@ namespace Umbraco.Web.Mvc
//we have no choice but to instantiate the controller
var instance = factory.CreateController(requestContext, controllerName);
return instance?.GetType();
var controllerType = instance?.GetType();
factory.ReleaseController(instance);
return controllerType;
}
}
}
@@ -81,7 +81,10 @@ namespace Umbraco.Web.Mvc
//we have no choice but to instantiate the controller
var instance = factory.CreateController(requestContext, controllerName);
return instance?.GetType();
var controllerType = instance?.GetType();
factory.ReleaseController(instance);
return controllerType;
}
return GetControllerType(requestContext, controllerName);