diff options
-rw-r--r-- | shell/ChangeLog | 15 | ||||
-rw-r--r-- | shell/e-setup.c | 68 | ||||
-rw-r--r-- | shell/e-shell.c | 3 | ||||
-rw-r--r-- | shell/evolution-local-storage.c | 3 | ||||
-rw-r--r-- | shell/evolution-storage.c | 1 |
5 files changed, 57 insertions, 33 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 1ae0d163cb..fc129d031e 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,18 @@ +2000-11-25 Federico Mena Quintero <federico@helixcode.com> + + * e-setup.c (check_dir_recur): Plug leaks of the fullname and + fulldefaultname. + (check_evolution_directory): Plug leaks of defaultdir and newfiles + and the list's data; made the code have a single return point. + + * e-shell.c (e_shell_restore_from_settings): Plug leak of prefix. + (corba_class_init): Plug leak; we were not assigning the + vepv->_base_epv. + + * evolution-storage.c (corba_class_init): Likewise. + + * evolution-local-storage.c (corba_class_init): Likewise. + 2000-11-24 Federico Mena Quintero <federico@helixcode.com> * evolution-shell-component.c diff --git a/shell/e-setup.c b/shell/e-setup.c index ee39f0d398..d9fc75f1dd 100644 --- a/shell/e-setup.c +++ b/shell/e-setup.c @@ -46,7 +46,7 @@ check_dir_recur (const char *evolution_directory, DIR *def; GList *newfiles = NULL; struct dirent *current; - + def = opendir (current_directory); if (def == NULL) return NULL; @@ -55,22 +55,22 @@ check_dir_recur (const char *evolution_directory, while (current != NULL) { struct stat buf; char *fullname, *fulldefaultname; - - fullname = g_concat_dir_and_file (evolution_directory, - current->d_name); - fulldefaultname = g_concat_dir_and_file (current_directory, - current->d_name); - if (current->d_name[0] == '.' && - (current->d_name[1] == '\0' || + if (current->d_name[0] == '.' && + (current->d_name[1] == '\0' || (current->d_name[1] == '.' && current->d_name[2] == '\0'))) { current = readdir (def); continue; } + fullname = g_concat_dir_and_file (evolution_directory, + current->d_name); + fulldefaultname = g_concat_dir_and_file (current_directory, + current->d_name); + if (stat (fullname, &buf) == -1) { char *name; - + name = g_strdup (fulldefaultname); newfiles = g_list_append (newfiles, name); } else { @@ -80,7 +80,7 @@ check_dir_recur (const char *evolution_directory, fulldefaultname)); } } - + g_free (fulldefaultname); g_free (fullname); current = readdir (def); @@ -103,27 +103,31 @@ check_evolution_directory (const char *evolution_directory) defaultdir = g_strdup (EVOLUTION_DATADIR "/evolution/default_user"); newfiles = g_list_concat (NULL, check_dir_recur (evolution_directory, defaultdir)); - - if (newfiles == NULL) - return TRUE; + + if (newfiles == NULL) { + retval = TRUE; + goto out; + } dialog = gnome_dialog_new (_("Evolution installation"), GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL); - + label1 = gtk_label_new (_("This new version of Evolution needs to install additional files\ninto your personal Evolution directory")); label2 = gtk_label_new (_("Please click \"OK\" to install the files, or \"Cancel\" to exit.")); - + gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label1, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label2, TRUE, TRUE, 0); - + gtk_widget_show (label1); gtk_widget_show (label2); result = gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); - if (result != 0) - return FALSE; + if (result != 0) { + retval = FALSE; + goto out; + } retval = TRUE; for (l = newfiles; l; l = l->next) { @@ -136,34 +140,34 @@ check_evolution_directory (const char *evolution_directory) evolution_directory, "/", shortpath, NULL); - + if (system (command) != 0) { retval = FALSE; } else { retval = (retval && TRUE); } - + g_free (command); - - g_free (l->data); } - g_list_free (newfiles); - g_free (defaultdir); - - if (retval == FALSE) { + if (retval == FALSE) e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, _("Could not update files correctly")); - return FALSE; - } else { + else e_notice (NULL, GNOME_MESSAGE_BOX_INFO, _("Evolution files successfully installed.")); - return TRUE; - } - return TRUE; + out: + + for (l = newfiles; l; l = l->next) + g_free (l->data); + + g_list_free (newfiles); + g_free (defaultdir); + + return retval; } - + static gboolean copy_default_stuff (const char *evolution_directory) diff --git a/shell/e-shell.c b/shell/e-shell.c index faad9979f1..b067514226 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -586,6 +586,7 @@ corba_class_init (void) epv->createStorageSetView = impl_Shell_create_storage_set_view; vepv = &shell_vepv; + vepv->_base_epv = base_epv; vepv->Bonobo_Unknown_epv = bonobo_object_get_epv (); vepv->GNOME_Evolution_Shell_epv = epv; } @@ -1017,6 +1018,8 @@ e_shell_restore_from_settings (EShell *shell) prefix = g_strdup_printf ("=%s/config/Shell=/Views/NumberOfViews", priv->local_directory); num_views = gnome_config_get_int (prefix); + g_free (prefix); + if (num_views == 0) return FALSE; diff --git a/shell/evolution-local-storage.c b/shell/evolution-local-storage.c index cec05b91fc..c0e900087b 100644 --- a/shell/evolution-local-storage.c +++ b/shell/evolution-local-storage.c @@ -121,7 +121,8 @@ corba_class_init (void) base_epv->default_POA = NULL; vepv = &LocalStorage_vepv; - vepv->Bonobo_Unknown_epv = bonobo_object_get_epv (); + vepv->_base_epv = base_epv; + vepv->Bonobo_Unknown_epv = bonobo_object_get_epv (); vepv->GNOME_Evolution_Storage_epv = evolution_storage_get_epv (); vepv->GNOME_Evolution_LocalStorage_epv = evolution_local_storage_get_epv (); } diff --git a/shell/evolution-storage.c b/shell/evolution-storage.c index 49b7b36805..d16d7f88c5 100644 --- a/shell/evolution-storage.c +++ b/shell/evolution-storage.c @@ -311,6 +311,7 @@ corba_class_init (void) base_epv->default_POA = NULL; vepv = &Storage_vepv; + vepv->_base_epv = base_epv; vepv->Bonobo_Unknown_epv = bonobo_object_get_epv (); vepv->GNOME_Evolution_Storage_epv = evolution_storage_get_epv (); } |