Changeset 3249

Show
Ignore:
Timestamp:
01/14/08 02:06:57
Author:
pvanhoof
Message:

2008-01-14 Philip Van Hoof <pvanhoof@gnome.org>

        • Some aggresive memory checking revealed a few interesting memory

leaks. This commit fixes those. The fixes are experimental, although
most of them double checked.

CamelOperation? holds one more significant memory leak at its
status_hack linked list. That one is not yet fixed.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r3248 r3249  
     12008-01-14  Philip Van Hoof <pvanhoof@gnome.org> 
     2 
     3        * Some aggresive memory checking revealed a few interesting memory 
     4        leaks. This commit fixes those. The fixes are experimental, although 
     5        most of them double checked. 
     6 
     7        CamelOperation holds one more significant memory leak at its 
     8        status_hack linked list. That one is not yet fixed. 
     9 
    1102008-01-13  Philip Van Hoof <pvanhoof@gnome.org> 
    211 
  • trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-command.c

    r3235 r3249  
    373373                imap_debug ("Recon in start: %s\n", camel_exception_get_description (&mex)); 
    374374 
     375                camel_exception_clear (&mex); 
    375376                return FALSE; 
    376377        } 
     
    414415                        imap_debug ("Recon in cont: %s\n", camel_exception_get_description (&mex)); 
    415416                        CAMEL_SERVICE_REC_UNLOCK (store, connect_lock); 
     417                        camel_exception_clear (&mex); 
    416418                        return NULL; 
    417419                } else 
     
    711713                                        camel_imap_recon (store, &mex); 
    712714                                        imap_debug ("Recon in untagged: %s\n", camel_exception_get_description (&mex)); 
     715                                        camel_exception_clear (&mex); 
    713716                                } else { 
    714717                                        camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, 
     
    730733                                camel_imap_recon (store, &mex); 
    731734                                imap_debug ("Recon in untagged idle: %s\n", camel_exception_get_description (&mex)); 
     735                                camel_exception_clear (&mex); 
    732736                        } else { 
    733737                                camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, 
     
    874878                                        camel_imap_recon (store, &mex); 
    875879                                        imap_debug ("Recon in untagged: %s\n", camel_exception_get_description (&mex)); 
     880                                        camel_exception_clear (&mex); 
    876881                                } else { 
    877882                                        camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, 
     
    893898                                camel_imap_recon (store, &mex); 
    894899                                imap_debug ("Recon in untagged idle: %s\n", camel_exception_get_description (&mex)); 
     900                                camel_exception_clear (&mex); 
    895901                        } else { 
    896902                                camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, 
  • trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-folder.c

    r3245 r3249  
    32993299                                store->dontdistridlehack = FALSE; 
    33003300 
     3301                                if (mchanges) { 
     3302                                        if (camel_folder_change_info_changed (mchanges)) 
     3303                                                camel_object_trigger_event (CAMEL_OBJECT (folder), "folder_changed", mchanges); 
     3304                                        camel_folder_change_info_free (mchanges); 
     3305                                        mchanges = NULL; 
     3306                                } 
     3307 
    33013308                                camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL); 
    33023309 
     
    33983405                                                        store->dontdistridlehack = FALSE; 
    33993406 
     3407                                                        if (mchanges) { 
     3408                                                                if (camel_folder_change_info_changed (mchanges)) 
     3409                                                                        camel_object_trigger_event (CAMEL_OBJECT (folder), "folder_changed", mchanges); 
     3410                                                                camel_folder_change_info_free (mchanges); 
     3411                                                                mchanges = NULL; 
     3412                                                        } 
     3413 
    34003414                                                        camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL); 
    34013415 
     
    34233437                                camel_folder_summary_kill_hash (folder->summary); 
    34243438                                store->dontdistridlehack = FALSE; 
     3439 
     3440                                if (mchanges) { 
     3441                                        if (camel_folder_change_info_changed (mchanges)) 
     3442                                                camel_object_trigger_event (CAMEL_OBJECT (folder), "folder_changed", mchanges); 
     3443                                        camel_folder_change_info_free (mchanges); 
     3444                                        mchanges = NULL; 
     3445                                } 
    34253446 
    34263447                                camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL); 
     
    53465367                                                err = TRUE; 
    53475368                                                ex_id = CAMEL_EXCEPTION_SERVICE_UNAVAILABLE; 
    5348                                                 errmessage = errmessage = g_strdup_printf ("Message with UID %s does not exists", uid); 
     5369                                                errmessage = g_strdup_printf ("Message with UID %s does not exists", uid); 
    53495370                                        } else{ 
    53505371                                                err = TRUE; 
  • trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store-summary.c

    r3235 r3249  
    5050 
    5151static void namespace_clear(CamelStoreSummary *s); 
     52 
     53static void namespace_free(CamelStoreSummary *s, CamelImapStoreNamespace *ns); 
    5254 
    5355static int summary_header_load(CamelStoreSummary *, FILE *); 
     
    439441} 
    440442 
    441 void camel_imap_store_summary_namespace_add(CamelImapStoreSummary *s, CamelImapStoreNamespace *ns) 
     443CamelImapStoreNamespace * camel_imap_store_summary_namespace_add(CamelImapStoreSummary *s, CamelImapStoreNamespace *ns) 
    442444{ 
    443445        gboolean add = TRUE; 
    444446        GList *lst = s->namespaces; 
     447        CamelImapStoreNamespace *ret = NULL; 
    445448 
    446449        while (lst) { 
     
    448451                if (n->full_name && ns->full_name && !strcmp (n->full_name, ns->full_name)) { 
    449452                        add = FALSE; 
     453                        ret = n; 
    450454                        break; 
    451455                } 
     
    453457        } 
    454458 
    455         if (add) 
     459        if (add) { 
    456460                s->namespaces = g_list_prepend (s->namespaces, ns); 
    457  
    458         return; 
     461                ret = ns; 
     462        } else 
     463                namespace_free((CamelStoreSummary*)s, ns); 
     464 
     465        return ret; 
    459466} 
    460467 
  • trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store-summary.h

    r3177 r3249  
    7878CamelImapStoreNamespace *camel_imap_store_summary_namespace_new(CamelImapStoreSummary *s, const char *full_name, char dir_sep); 
    7979void camel_imap_store_summary_namespace_set(CamelImapStoreSummary *s, CamelImapStoreNamespace *ns); 
    80 void camel_imap_store_summary_namespace_add(CamelImapStoreSummary *s, CamelImapStoreNamespace *ns); 
     80CamelImapStoreNamespace *camel_imap_store_summary_namespace_add(CamelImapStoreSummary *s, CamelImapStoreNamespace *ns); 
    8181CamelImapStoreNamespace *camel_imap_store_summary_namespace_find_path(CamelImapStoreSummary *s, const char *path); 
    8282CamelImapStoreNamespace *camel_imap_store_summary_namespace_find_full(CamelImapStoreSummary *s, const char *full_name); 
  • trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c

    r3235 r3249  
    18991899                if (namespaces && namespaces->personal) { 
    19001900                        ns = camel_imap_store_summary_namespace_new(store->summary, namespaces->personal->prefix, namespaces->personal->delim); 
    1901                         camel_imap_store_summary_namespace_add(store->summary,ns); 
     1901                        ns = camel_imap_store_summary_namespace_add(store->summary,ns); 
    19021902                        camel_imap_store_summary_namespace_set(store->summary, ns); 
    19031903                } 
     
    19051905                if (namespaces && namespaces->other) { 
    19061906                        ns = camel_imap_store_summary_namespace_new(store->summary, namespaces->other->prefix, namespaces->other->delim); 
    1907                         camel_imap_store_summary_namespace_add(store->summary,ns); 
     1907                        ns = camel_imap_store_summary_namespace_add(store->summary,ns); 
    19081908                } 
    19091909 
    19101910                if (namespaces && namespaces->shared) { 
    19111911                        ns = camel_imap_store_summary_namespace_new(store->summary, namespaces->shared->prefix, namespaces->shared->delim); 
    1912                         camel_imap_store_summary_namespace_add(store->summary,ns); 
     1912                        ns = camel_imap_store_summary_namespace_add(store->summary,ns); 
    19131913                } 
    19141914 
     
    35863586                                                hfi->unread = fi->unread; 
    35873587                                                hfi->total = fi->total; 
     3588                                                camel_folder_info_free(fi); 
    35883589                                        } 
    35893590                                } 
     
    36513652                                                        hfi->total = fi->total; 
    36523653                                                } 
     3654                                                camel_folder_info_free(fi); 
    36533655                                        } 
    36543656                                } 
     
    37253727                        fi->flags |= CAMEL_FOLDER_SUBSCRIBED; 
    37263728                        g_hash_table_insert(present, fi->full_name, fi); 
    3727                 } 
     3729                } else  
     3730                        camel_folder_info_free(fi); 
    37283731        } 
    37293732 
     
    41934196                        camel_imap_recon (store, &mex); 
    41944197                        imap_debug ("Recon: %s\n", camel_exception_get_description (&mex)); 
     4198                        camel_exception_clear (&mex); 
    41954199                } else { 
    41964200                        camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, 
     
    42684272                        camel_imap_recon (store, &mex); 
    42694273                        imap_debug ("Recon in nl: %s\n", camel_exception_get_description (&mex)); 
     4274                        camel_exception_clear (&mex); 
    42704275                } else { 
    42714276                        camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, 
  • trunk/libtinymail-camel/camel-lite/camel/providers/local/camel-maildir-folder.c

    r3235 r3249  
    206206                *appended_uid = g_strdup(camel_message_info_uid(mi)); 
    207207 
     208        if (output_stream) 
     209                camel_object_unref (output_stream); 
     210 
    208211        return; 
    209212 
  • trunk/libtinymail-camel/tny-camel-msg-header.c

    r3235 r3249  
    7777                        ret = g_strdup (str); 
    7878                } 
     79 
     80                if (ct) 
     81                        camel_content_type_unref (ct); 
     82 
    7983                return ret; 
    8084        } 
     85 
     86        if (ct) 
     87                camel_content_type_unref (ct); 
    8188 
    8289        return camel_header_decode_string (str, charset); 
  • trunk/libtinymail-gnome-desktop/tny-gnome-device.c

    r3247 r3249  
    219219#ifndef IMMEDIATE_ONLINE_TEST 
    220220        priv->current_state = tny_gnome_device_is_online (TNY_DEVICE (self)); 
    221         if (priv->nm_ctx) 
    222               priv->callback_id = libnm_glib_register_callback  
    223                       (priv->nm_ctx, nm_callback, self, NULL); 
     221        //if (priv->nm_ctx) 
     222        //    priv->callback_id = libnm_glib_register_callback  
     223        //            (priv->nm_ctx, nm_callback, self, NULL); 
    224224#endif 
    225225#endif