r18295 - gnucash/trunk/src - Fix more valgrind problems

Phil Longstaff plongstaff at code.gnucash.org
Sat Sep 5 16:53:50 EDT 2009


Author: plongstaff
Date: 2009-09-05 16:53:50 -0400 (Sat, 05 Sep 2009)
New Revision: 18295
Trac: http://svn.gnucash.org/trac/changeset/18295

Modified:
   gnucash/trunk/src/app-utils/gnc-ui-util.c
   gnucash/trunk/src/app-utils/gnc-ui-util.h
   gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c
Log:
Fix more valgrind problems


Modified: gnucash/trunk/src/app-utils/gnc-ui-util.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-ui-util.c	2009-09-05 13:16:20 UTC (rev 18294)
+++ gnucash/trunk/src/app-utils/gnc-ui-util.c	2009-09-05 20:53:50 UTC (rev 18295)
@@ -750,9 +750,16 @@
 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

Modified: gnucash/trunk/src/app-utils/gnc-ui-util.h
===================================================================
--- gnucash/trunk/src/app-utils/gnc-ui-util.h	2009-09-05 13:16:20 UTC (rev 18294)
+++ gnucash/trunk/src/app-utils/gnc-ui-util.h	2009-09-05 20:53:50 UTC (rev 18295)
@@ -192,6 +192,13 @@
                                              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);
 
 

Modified: gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c
===================================================================
--- gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c	2009-09-05 13:16:20 UTC (rev 18294)
+++ gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c	2009-09-05 20:53:50 UTC (rev 18295)
@@ -353,7 +353,7 @@
         // 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)",



More information about the gnucash-changes mailing list