Re: [PATCH] resubmission for the add-tny_camel_send_queue_new_with_folders() patch



On Sun, 2008-10-26 at 17:01 +0100, Martin Bonnin wrote:
>  
> +TnySendQueue*
> +tny_camel_send_queue_new_with_folders (TnyCamelTransportAccount
> *trans_account, TnyFolder *outbox, TnyFolder *sentbox)
> +{
> +       TnyCamelSendQueue *self = g_object_new
> (TNY_TYPE_CAMEL_SEND_QUEUE, NULL);
> +       TnyCamelSendQueuePriv *priv = TNY_CAMEL_SEND_QUEUE_GET_PRIVATE
> (self);
> +
> +       g_assert (TNY_IS_CAMEL_TRANSPORT_ACCOUNT (trans_account));
> +       priv->outbox_cache  = g_object_ref(outbox);
> +       priv->sentbox_cache = g_object_ref(sentbox);


You are leaking the existing outbox_cache and sentbox_cache here.

Add these in front of the lines:

 if (priv->sentbox_cache)
            g_object_unref (priv->sentbox_cache);
 if (priv->outbox_cache)
            g_object_unref (priv->outbox_cache);

It's not likely that they'll be filled in, but it's good practice
nonetheless to do this.


> +       tny_camel_send_queue_set_transport_account (self,
> trans_account);
> +
> +       return TNY_SEND_QUEUE (self);
> +}


-- 
Philip Van Hoof, freelance software developer
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org 
http://pvanhoof.be/blog
http://codeminded.be



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]