netprofm: Release connection point sink entries in object destructor.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2017-08-18 14:43:39 +02:00 committed by Alexandre Julliard
parent ba156ed28b
commit c289169aaa
1 changed files with 17 additions and 3 deletions

View File

@ -222,6 +222,13 @@ static HRESULT WINAPI connection_point_Advise(
return S_OK;
}
static void sink_entry_release( struct sink_entry *entry )
{
list_remove( &entry->entry );
IUnknown_Release( entry->unk );
heap_free( entry );
}
static HRESULT WINAPI connection_point_Unadvise(
IConnectionPoint *iface,
DWORD cookie )
@ -234,9 +241,7 @@ static HRESULT WINAPI connection_point_Unadvise(
LIST_FOR_EACH_ENTRY( iter, &cp->sinks, struct sink_entry, entry )
{
if (iter->cookie != cookie) continue;
list_remove( &iter->entry );
IUnknown_Release( iter->unk );
heap_free( iter );
sink_entry_release( iter );
return S_OK;
}
@ -278,6 +283,12 @@ static void connection_point_init(
list_init( &cp->sinks );
}
static void connection_point_release( struct connection_point *cp )
{
while (!list_empty( &cp->sinks ))
sink_entry_release( LIST_ENTRY( list_head( &cp->sinks ), struct sink_entry, entry ) );
}
static inline struct network *impl_from_INetwork(
INetwork *iface )
{
@ -1110,6 +1121,9 @@ static ULONG WINAPI list_manager_Release(
TRACE( "destroying %p\n", mgr );
connection_point_release( &mgr->conn_mgr_cp );
connection_point_release( &mgr->cost_mgr_cp );
connection_point_release( &mgr->list_mgr_cp );
while ((ptr = list_head( &mgr->networks )))
{
struct network *network = LIST_ENTRY( ptr, struct network, entry );