17.11.2015 18:11, Dimitry Sibiryakov пишет:
>     Hello, All.
>
>     A typical piece of code:
>
>>              // do not assign cryptPlugin directly before key init complete
>>              IDbCryptPlugin* p = cryptControl.plugin();
>>              keyHolderPlugins.init(p);
>>              cryptPlugin = p;
>>              cryptPlugin->addRef();
>     AFAIU, if call of keyHolderPlugins.init() throw anything, memory will 
> leak because p is
> a dumb pointer.
>     Call of cryptPlugin->addRef() will bring the counter to two and the 
> plugin will never
> be released.
>
>     What have I missed?
>

Lifetime of interface, returned by plugin(), is determined by 
cryptControl variable. In destructor of cryptControl will call 
releasePlugin() for it.



------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to