[Dovecot] Creating and interacting with array inside plugin

Timo Sirainen tss at iki.fi
Fri Feb 24 01:34:48 EET 2012


On 23.2.2012, at 18.19, Alex Baule wrote:

> ok, inside my expunged rewrite function i create the array like quota
> does, and append it to my array.
> 
> struct emexis_ids_x_uis append_uis;
> append_uis.ids = _mail->uid;
> append_uis.uis_file = bodyFile;
..
> But when i do a foreach in this Array, my ids is OK, but my uis_file
> has tha same value every time (the value is the lasted value
> inserted).

I guess the memory isn't permanently allocated for it, so you need to do:

append_uis.uis_file = i_strdup(bodyFile);

Note that you'll also need to later i_free() it to avoid leaking memory.




More information about the dovecot mailing list