3
Vote

SPDisposeCheck reports leaked SPSite object in MayaIntl.SharePoint.ApplicationPages.Common.GetWeb()

description

The GeWeb() method:
 
internal static SPWeb GetWeb(HttpContext context, string siteUrl)
{
SPWeb web;
if (string.IsNullOrEmpty(siteUrl))
{
    web = SPControl.GetContextWeb(context);
}
else
{
    SPSite site = new SPSite(siteUrl);
    web = site.OpenWeb();
}
return web;
}
 
The line SPSite site = new SPSite(siteUrl); will leak as per the SPDisposeCheck guidelines.
 
Colin

comments

ripster wrote Jun 25, 2009 at 11:15 AM

I should also note that the returned SPWeb object does not get cleaned properly in the calling method then it will also leak.

wrote Jun 25, 2009 at 1:19 PM

pianoman84 wrote Dec 2, 2009 at 6:56 AM

Is this issue fixed in the new release 2.0?
Otherwise, I'm not able to install it on our farm :-(
Would be a pitty.

leonidly wrote Dec 2, 2009 at 12:57 PM

Not yet, sorry. it is on TODO list.

wrote Jan 20, 2011 at 9:28 PM

wrote Feb 14, 2013 at 12:51 AM