mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-09-03 20:53:02 -05:00
Fix an ofx import memory leak and a non-ascii-path problem on win32.
On Win32, the import file path needs to be converted to the system codepage for libofx. Also, free it afterwards. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16296 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -636,7 +636,7 @@ void gnc_file_ofx_import (void)
|
||||
extern int ofx_ERROR_msg;
|
||||
extern int ofx_INFO_msg;
|
||||
extern int ofx_STATUS_msg;
|
||||
const char *selected_filename;
|
||||
char *selected_filename;
|
||||
char *default_dir;
|
||||
LibofxContextPtr libofx_context = libofx_get_new_context();
|
||||
|
||||
@@ -658,6 +658,10 @@ void gnc_file_ofx_import (void)
|
||||
|
||||
if(selected_filename!=NULL)
|
||||
{
|
||||
#ifdef G_OS_WIN32
|
||||
gchar *conv_name;
|
||||
#endif
|
||||
|
||||
/* Remember the directory as the default. */
|
||||
default_dir = g_path_get_dirname(selected_filename);
|
||||
gnc_set_default_directory(GCONF_SECTION, default_dir);
|
||||
@@ -677,9 +681,15 @@ void gnc_file_ofx_import (void)
|
||||
ofx_set_security_cb(libofx_context, ofx_proc_security_cb, 0);
|
||||
/*ofx_set_status_cb(libofx_context, ofx_proc_status_cb, 0);*/
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
conv_name = g_win32_locale_filename_from_utf8(selected_filename);
|
||||
g_free(selected_filename);
|
||||
selected_filename = conv_name;
|
||||
#endif
|
||||
|
||||
DEBUG("Opening selected file");
|
||||
libofx_proc_file(libofx_context, selected_filename, AUTODETECT);
|
||||
g_free(selected_filename);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user