[PATCH] Free memory in the gnc_gnome_help function

Yawar Amin yawar.amin at gmail.com
Sun Jan 13 17:14:17 EST 2013


Hi,

Came across this when I was trying to figure out how to test the
documentation. See patch for details.

Thanks,

Yawar

-------------- next part --------------
From 1adf4e8959f50fc1469b72a261ad04d844a8cad9 Mon Sep 17 00:00:00 2001
From: Yawar Amin <yawar.amin at gmail.com>
Date: Sat, 12 Jan 2013 18:09:25 -0500
Subject: [PATCH] gnc_gnome_help: Free allocated mem

In the Linux version of the function, the string `uri' has memory
allocated for it by the g_strconcat function. Should be freed.

Signed-off-by: Yawar Amin <yawar.amin at gmail.com>
---
 src/gnome-utils/gnc-gnome-utils.c |   22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/gnome-utils/gnc-gnome-utils.c b/src/gnome-utils/gnc-gnome-utils.c
index 7d89726..13d9efd 100644
--- a/src/gnome-utils/gnc-gnome-utils.c
+++ b/src/gnome-utils/gnc-gnome-utils.c
@@ -419,18 +419,18 @@ gnc_gnome_help (const char *file_name, const char *anchor)
 
     DEBUG ("Attempting to opening help uri %s", uri);
 
-    if (gtk_show_uri (NULL, uri, gtk_get_current_event_time (), &error))
-        return;
-
-    g_assert(error != NULL);
-    {
-        const gchar *message =
-            _("GnuCash could not find the files for the help documentation.  "
-              "This is likely because the 'gnucash-docs' package is not installed.");
-        gnc_error_dialog(NULL, "%s", message);
+    if (!gtk_show_uri (NULL, uri, gtk_get_current_event_time (), &error)) {
+      g_assert(error != NULL);
+      {
+          const gchar *message =
+              _("GnuCash could not find the files for the help documentation.  "
+                "This is likely because the 'gnucash-docs' package is not installed.");
+          gnc_error_dialog(NULL, "%s", message);
+      }
+      PERR ("%s", error->message);
+      g_error_free(error);
     }
-    PERR ("%s", error->message);
-    g_error_free(error);
+    g_free (uri);
 }
 
 
-- 
1.7.9.5

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 897 bytes
Desc: OpenPGP digital signature
URL: <http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20130113/8c8a252e/attachment.sig>


More information about the gnucash-devel mailing list