[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ms-dcom
Subject:    Re: Help Needed
From:       Seshu Madabushi <SMadabushi () ISOFT ! COM>
Date:       2004-05-04 15:33:05
Message-ID: 4962B73AD3A1704FA415C8E7A077403508FAEB () isoftmail01
[Download RAW message or body]

I am using BoundsChecker, but it is not saying any memory leaks, no
wrong pointers to free etc. 

I am pasting part of the code here, loading and unloading the libraries.
Please let me know if I am doing anything wrong.

Thanks
Seshu

Release Function

STDMETHODIMP_(ULONG)LIB::Release( void )
{
        m_ulRef--;
        if( 0 == m_ulRef )
        {
                delete this;
                g_ulObjects--;
                if( ::ServerCanUnloadNow() )
                        ::UnloadServer();
        	
                return( 0 );
        }

        return( m_ulRef );
}


BOOL ServerCanUnloadNow( void )
{
        if( 0 == g_ulObjects && 0 == g_ulLocks )
                return( TRUE );
        else
                return( FALSE );
}

void UnloadServer( void )
{
        return;
}

Loading the Library

STDMETHODIMP LIBFactory::CreateInstance( IUnknown* pUnknownOuter, REFIID
iid, LPVOID* ppv )
{
        //      declare local variables
        HRESULT                         hr;
        LIB*                    PLIB = NULL;

        //      disallow aggregation
        *ppv = NULL;
        if( NULL != pUnknownOuter )
                return( CLASS_E_NOAGGREGATION );

        //      attempt to allocate storage for instance
        PLIB = new PLIB();
        if( NULL == PLIB )
                return( E_OUTOFMEMORY );

        //      query the interface
        hr = PLIB->QueryInterface( iid, ppv );
        if( FAILED( hr ))
        {
                delete PLIB;
                PLIB = NULL;
                return( hr );
        }

        //      increment object counter
        g_ulObjects++;

        return( NOERROR );
}


Is there anything wrong in the initialize and release calls?

Thanks
Seshu

----------------------------------------------------------------
Users Guide http://discuss.microsoft.com/archives/mailfaq.html
contains important info. Save time, search the archives at
http://discuss.microsoft.com/archives/index.html .
To unsubscribe, mailto:DCOM-signoff-request@DISCUSS.MICROSOFT.COM

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic