* Fixes several memory leaks
authorSergio Villar Senin <svillar@igalia.com>
Tue, 21 Oct 2008 15:33:15 +0000 (15:33 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Tue, 21 Oct 2008 15:33:15 +0000 (15:33 +0000)
* Adds the "static" modifier to a private function

pmo-trunk-r6136

src/hildon2/modest-secureauth-picker.c
src/maemo/easysetup/modest-easysetup-wizard-dialog.c
src/maemo/modest-msg-edit-window.c
src/maemo/modest-msg-view-window.c
src/maemo/modest-platform.c

index 44af40b..14b52f8 100644 (file)
@@ -79,7 +79,7 @@ enum MODEL_COLS {
        MODEL_COL_ID = 1 /* an int. */
 };
 
-void modest_secureauth_picker_fill (ModestSecureauthPicker *picker);
+static void modest_secureauth_picker_fill (ModestSecureauthPicker *picker);
 
 static gchar *
 touch_selector_print_func (HildonTouchSelector *selector)
@@ -145,7 +145,8 @@ modest_secureauth_picker_new (HildonSizeType size,
  * #picker: The combo box.
  * @protocol: IMAP or POP.
  */
-void modest_secureauth_picker_fill (ModestSecureauthPicker *picker)
+static void 
+modest_secureauth_picker_fill (ModestSecureauthPicker *picker)
 {      
        ModestSecureauthPickerPrivate *priv;
        GtkListStore *liststore;
index 17b98f8..90c1f96 100644 (file)
@@ -1689,6 +1689,7 @@ on_before_next (ModestWizardDialog *dialog, GtkWidget *current_page, GtkWidget *
                /* Aavoid a clash with an existing display name: */
                const gboolean name_in_use = modest_account_mgr_account_with_display_name_exists (
                        priv->account_manager, account_title);
+               g_free (account_title);
 
                if (name_in_use) {
                        /* Warn the user via a dialog: */
@@ -1874,7 +1875,7 @@ save_to_settings (ModestEasysetupWizardDialog *self)
 {
        ModestEasysetupWizardDialogPrivate *priv = MODEST_EASYSETUP_WIZARD_DIALOG_GET_PRIVATE (self);
        guint special_port;
-       gchar *provider_id;
+       gchar *provider_id = NULL;
        gchar* display_name;
        const gchar *username, *password;
        gchar *store_hostname, *transport_hostname;
@@ -1927,6 +1928,7 @@ save_to_settings (ModestEasysetupWizardDialog *self)
                                   "but it's not a ModestAccountProtocol");
                }
 
+               g_free (provider_id);
                return;
        }
 
@@ -2099,5 +2101,6 @@ save_to_settings (ModestEasysetupWizardDialog *self)
        display_name = get_entered_account_title (self);
        modest_account_settings_set_display_name (priv->settings, display_name);
        g_free (display_name);
+       g_free (provider_id);
 }
 
index 65981b0..d322a21 100644 (file)
@@ -1000,6 +1000,8 @@ pixbuf_from_stream (TnyStream *stream, const gchar *mime_type, guint64 *stream_s
                readed = tny_stream_read (TNY_STREAM (stream), (char *) read_buffer, 128);
                size += readed;
                if (!gdk_pixbuf_loader_write (loader, read_buffer, readed, &error)) {
+                       if (error)
+                               g_free (error);
                        break;
                }
        }
@@ -1893,6 +1895,7 @@ modest_msg_edit_window_set_format_state (ModestMsgEditWindow *self,
        
        text_buffer_refresh_attributes (WP_TEXT_BUFFER (priv->text_buffer), self);
        
+       g_free (buffer_format);
        g_free (current_format);
 
        /* Check dimming rules */
@@ -3561,7 +3564,7 @@ text_buffer_apply_tag (GtkTextBuffer *buffer, GtkTextTag *tag,
        ModestMsgEditWindowPrivate *priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (userdata);
        gchar *tag_name;
 
-       if (tag == NULL+13) return;
+       if (tag == NULL) return;
        g_object_get (G_OBJECT (tag), "name", &tag_name, NULL);
        if ((tag_name != NULL) && (g_str_has_prefix (tag_name, "image-tag-replace-"))) {
                replace_with_images (window, priv->images);
index 34778ba..0455e3e 100644 (file)
@@ -775,6 +775,7 @@ select_next_valid_row (GtkTreeModel *model,
                                if (msg_is_visible (header, is_outbox)) {
                                        next = gtk_tree_model_get_path (model, &tmp_iter);
                                        *row_reference = gtk_tree_row_reference_new (model, next);
+                                       gtk_tree_path_free (next);
                                        retval = TRUE;
                                        finished = TRUE;
                                }
@@ -804,6 +805,7 @@ select_next_valid_row (GtkTreeModel *model,
                                   message */
                                finished = TRUE;
                        }
+                       gtk_tree_path_free (next);
                } else {
                        /* If there are no more messages and we don't
                           want to start again in the first one then
@@ -814,8 +816,6 @@ select_next_valid_row (GtkTreeModel *model,
 
        /* Free */
        gtk_tree_path_free (path);
-       if (next)
-               gtk_tree_path_free (next);
 
        return retval;
 }
index 6c47d9d..9ea8117 100644 (file)
@@ -531,6 +531,7 @@ entry_insert_text (GtkEditable *editable,
 
        chars = gtk_editable_get_chars (editable, 0, -1);
        chars_length = g_utf8_strlen (chars, -1);
+       g_free (chars);
 
        /* Show WID-INF036 */
        if (chars_length >= 20) {
@@ -1615,6 +1616,8 @@ on_timeout_check_account_is_online(CheckAccountIdleData* data)
 gboolean
 modest_platform_check_and_wait_for_account_is_online(TnyAccount *account)
 {
+       gboolean is_online;
+
        g_return_val_if_fail (account, FALSE);
        
        printf ("DEBUG: %s: account id=%s\n", __FUNCTION__, tny_account_get_id (account));
@@ -1658,9 +1661,10 @@ modest_platform_check_and_wait_for_account_is_online(TnyAccount *account)
        g_main_loop_unref (data->loop);
        /* g_main_context_unref (context); */
 
+       is_online = data->is_online;
        g_slice_free (CheckAccountIdleData, data);
        
-       return data->is_online; 
+       return is_online;       
 }