From 47ef48b8dd6e1ea2398b24a5dc7ba7aa6c8b788e Mon Sep 17 00:00:00 2001 From: Phil Longstaff Date: Sat, 5 Sep 2009 20:53:50 +0000 Subject: [PATCH] Fix more valgrind problems git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18295 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/app-utils/gnc-ui-util.c | 9 ++++++++- src/app-utils/gnc-ui-util.h | 7 +++++++ src/report/report-gnome/gnc-plugin-page-report.c | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/app-utils/gnc-ui-util.c b/src/app-utils/gnc-ui-util.c index b03d4a80a0..e1851c3899 100644 --- a/src/app-utils/gnc-ui-util.c +++ b/src/app-utils/gnc-ui-util.c @@ -750,9 +750,16 @@ gnc_account_create_opening_balance (Account *account, char * gnc_account_get_full_name (const Account *account) { + static gchar result[1000]; + gchar* name; + if (!account) return NULL; - return xaccAccountGetFullName (account); + name = xaccAccountGetFullName (account); + strncpy( result, name, sizeof(result)-1 ); + result[sizeof(result)] = '\0'; + + return result; } static void diff --git a/src/app-utils/gnc-ui-util.h b/src/app-utils/gnc-ui-util.h index 911620402d..0fc60bba73 100644 --- a/src/app-utils/gnc-ui-util.h +++ b/src/app-utils/gnc-ui-util.h @@ -192,6 +192,13 @@ gboolean gnc_account_create_opening_balance (Account *account, time_t date, QofBook *book); +/** + * Returns the account full name. Unlike xaccAccountGetFullName(), the + * string returned must *NOT* be freed. + * + * @param account Account + * @return Account full name + */ char * gnc_account_get_full_name (const Account *account); diff --git a/src/report/report-gnome/gnc-plugin-page-report.c b/src/report/report-gnome/gnc-plugin-page-report.c index 87fe6a0ea3..70e3f011ef 100644 --- a/src/report/report-gnome/gnc-plugin-page-report.c +++ b/src/report/report-gnome/gnc-plugin-page-report.c @@ -353,7 +353,7 @@ gnc_plugin_page_report_create_widget( GncPluginPage *page ) // FIXME. This is f^-1(f(x)), isn't it? DEBUG( "id=%d", priv->reportId ); id_name = g_strdup_printf("id=%d", priv->reportId ); - child_name = gnc_build_url( URL_TYPE_REPORT, id_name, NULL ); + child_name = gnc_html_build_url( URL_TYPE_REPORT, id_name, NULL ); type = gnc_html_parse_url( priv->html, child_name, &url_location, &url_label); DEBUG( "passing id_name=[%s] child_name=[%s] type=[%s], location=[%s], label=[%s]", id_name, child_name ? child_name : "(null)",