r18294 - gnucash/trunk/src - Fix bug 587891: Memory leak - results of gnc-build-url
Phil Longstaff
plongstaff at code.gnucash.org
Sat Sep 5 09:16:21 EDT 2009
Author: plongstaff
Date: 2009-09-05 09:16:20 -0400 (Sat, 05 Sep 2009)
New Revision: 18294
Trac: http://svn.gnucash.org/trac/changeset/18294
Modified:
gnucash/trunk/src/html/gnc-html.c
gnucash/trunk/src/html/gnc-html.h
gnucash/trunk/src/report/report-gnome/window-report.c
Log:
Fix bug 587891: Memory leak - results of gnc-build-url
Modified: gnucash/trunk/src/html/gnc-html.c
===================================================================
--- gnucash/trunk/src/html/gnc-html.c 2009-09-05 00:35:40 UTC (rev 18293)
+++ gnucash/trunk/src/html/gnc-html.c 2009-09-05 13:16:20 UTC (rev 18294)
@@ -564,9 +564,38 @@
gnc_html_register_urltype (types[i].type, types[i].protocol);
}
-char *
-gnc_build_url (URLType type, const gchar * location, const gchar * label)
+/**
+ * Creates a new HMTL url.
+ *
+ * @param type URL type
+ * @param location URL location
+ * @param label URL label (optional)
+ * @return Newly created URL. This string must be *NOT* freed by the caller.
+ */
+gchar*
+gnc_build_url( URLType type, const gchar* location, const gchar* label )
{
+ static gchar buf[1000];
+ gchar* url;
+
+ url = gnc_html_build_url( type, location, label );
+ strncpy( buf, url, sizeof(buf) );
+ g_free( url );
+
+ return buf;
+}
+
+/**
+ * Creates a new HMTL url.
+ *
+ * @param type URL type
+ * @param location URL location
+ * @param label URL label (optional)
+ * @return Newly created URL. This string must be freed by the caller.
+ */
+gchar*
+gnc_html_build_url( URLType type, const gchar* location, const gchar* label )
+{
char * type_name;
DEBUG(" ");
Modified: gnucash/trunk/src/html/gnc-html.h
===================================================================
--- gnucash/trunk/src/html/gnc-html.h 2009-09-05 00:35:40 UTC (rev 18293)
+++ gnucash/trunk/src/html/gnc-html.h 2009-09-05 13:16:20 UTC (rev 18294)
@@ -265,4 +265,6 @@
const gchar* gnc_html_get_embedded_param( gpointer eb, const gchar* param_name );
+gchar* gnc_html_build_url( URLType type, const gchar* location, const gchar* label );
+
#endif
Modified: gnucash/trunk/src/report/report-gnome/window-report.c
===================================================================
--- gnucash/trunk/src/report/report-gnome/window-report.c 2009-09-05 00:35:40 UTC (rev 18293)
+++ gnucash/trunk/src/report/report-gnome/window-report.c 2009-09-05 13:16:20 UTC (rev 18294)
@@ -283,7 +283,7 @@
{
char *url;
- url = gnc_build_url (URL_TYPE_REPORT, location, label);
+ url = gnc_html_build_url (URL_TYPE_REPORT, location, label);
gnc_main_window_open_report_url (url, NULL);
g_free (url);
More information about the gnucash-changes
mailing list