gnucash maint: Bug 761667 - Crash opening associated location that has no scheme

John Ralls jralls at code.gnucash.org
Sun Sep 11 18:48:49 EDT 2016


Updated	 via  https://github.com/Gnucash/gnucash/commit/3e30989d (commit)
	from  https://github.com/Gnucash/gnucash/commit/876f57ef (commit)



commit 3e30989de96b27bc3da77f85eebbfa5f59b9b127
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Sep 11 15:47:52 2016 -0700

    Bug 761667 - Crash opening associated location that has no scheme
    
    Blindingly obvious on inspection. Fixes a memory leak too.

diff --git a/src/gnome-utils/gnc-gnome-utils.c b/src/gnome-utils/gnc-gnome-utils.c
index 49da53e..3737590 100644
--- a/src/gnome-utils/gnc-gnome-utils.c
+++ b/src/gnome-utils/gnc-gnome-utils.c
@@ -431,9 +431,10 @@ void
 gnc_launch_assoc (const char *uri)
 {
     wchar_t *winuri = NULL;
+    char* scheme = g_uri_parse_scheme(uri);
     /* ShellExecuteW open doesn't decode http escapes if it's passed a
      * file URI so we have to do it. */
-    if (strcmp (g_uri_parse_scheme(uri), "file") == 0)
+    if (scheme && strcmp (scheme, "file") == 0)
     {
 	gchar *filename = g_filename_from_uri (uri, NULL, NULL);
 	winuri = (wchar_t *)g_utf8_to_utf16(filename, -1, NULL, NULL, NULL);
@@ -455,6 +456,7 @@ gnc_launch_assoc (const char *uri)
 	g_free (wincmd);
 	g_free (winuri);
     }
+    g_free (scheme);
 }
 
 #else



Summary of changes:
 src/gnome-utils/gnc-gnome-utils.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)



More information about the gnucash-changes mailing list