Share via


C28624

advertencia C28624: No hay ninguna llamada a Release() para que coincida con el recuento de referencias incrementado de LResultFromObject

LresultFromObject aumenta el recuento de referencias en nuevos objetos IAccessible.

Ejemplo

El ejemplo de código siguiente genera esta advertencia.

{
 IAccessible *pacc = CreateNewIAccessible();
 LRESULT lTemp = LresultFromObject(riid, NULL, pacc );
}

{
 IAccessible *pacc = NULL;
 // Get new interface (from same object)
 QueryInterface( & pacc );

 // Lresult will internally bump up the refcount
 // to hold onto the object.
 
 LRESULT lTemp = LresultFromObject( riid, NULL, pacc );
}

En el ejemplo siguiente se evita el error.

{
 IAccessible *pacc = CreateNewIAccessible();
 // Lresult internally increases the refcount to
 // hold onto the object.
 LRESULT lTemp = LresultFromObject(riid, NULL, pacc );

 // We no longer need our pacc interface, so we release it.

 pacc->Release();
}