[gnome-builder] uri: keep cleaned_uri_string around for use in g_set_error()



commit af69ab42551283710587308d050543646b0632b2
Author: Christian Hergert <christian hergert me>
Date:   Mon Apr 18 18:57:24 2016 -0700

    uri: keep cleaned_uri_string around for use in g_set_error()
    
    If we want to be able to use uri_string in the error message, we need to
    ensure our temporary string sticks around long enough to potentially use
    it.

 libide/ide-uri.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
---
diff --git a/libide/ide-uri.c b/libide/ide-uri.c
index 9ae8f72..ea951eb 100644
--- a/libide/ide-uri.c
+++ b/libide/ide-uri.c
@@ -580,8 +580,8 @@ ide_uri_new_relative (IdeUri            *base_uri,
                       IdeUriParseFlags   flags,
                       GError           **error)
 {
+  g_autofree gchar *cleaned_uri_string = NULL;
   IdeUri *raw = NULL, *uri = NULL;
-  gchar *cleaned_uri_string = NULL;
   gchar *raw_port = NULL;
 
   if (base_uri && !base_uri->scheme)
@@ -606,8 +606,6 @@ ide_uri_new_relative (IdeUri            *base_uri,
   ide_uri_split (uri_string, (flags & IDE_URI_PARSE_STRICT) != 0,
                &raw->scheme, &raw->user, &raw->host, &raw_port,
                &raw->path, &raw->query, &raw->fragment);
-  if (cleaned_uri_string)
-    g_free (cleaned_uri_string);
 
   if (raw->scheme)
     uri->scheme = g_ascii_strdown (raw->scheme, -1);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]