memory management

Ken Murchison ken at oceana.com
Mon Oct 10 10:34:51 EDT 2005


Arvind Sachdeva wrote:

> Hi,
> 
> I am writing client/server plugin for cyrus library. I allocated memory 
> for serverout string in mech_step function on server side. Where is this 
> string supposed to be freed ? According to the general convention if my 
> plugin allocates the memory it should be freeing it. But I dont 
> understand in which function should I free the memory.
> Should I cache the pointer and free it on subsequent mech_step call, or 
> should I do something like cache all pointers and free them at the end.
> 
> Or am I missing a simple function that will be called back from the 
> application just for this purpose ?

You'd probably free() the memory in mech_dispose() or mech_free().  You 
could probably use the PLAIN plugin as a template.

-- 
Kenneth Murchison     Oceana Matrix Ltd.
Software Engineer     21 Princeton Place
716-662-8973 x26      Orchard Park, NY 14127
--PGP Public Key--    http://www.oceana.com/~ken/ksm.pgp


More information about the Cyrus-sasl mailing list