diff options
author | Daniel Boles <dboles@src.gnome.org> | 2018-03-13 00:19:51 +0000 |
---|---|---|
committer | Daniel Boles <dboles@src.gnome.org> | 2018-03-13 00:19:51 +0000 |
commit | 0f3396d7423d9f76506f91ac8a97adc1df5cf50f (patch) | |
tree | ca0322637c9d7ec9be5977fffaa739d310632cd2 | |
parent | 9d8fadee976d589645663eade2b83258ed0a005e (diff) | |
download | gtk+-0f3396d7423d9f76506f91ac8a97adc1df5cf50f.tar.gz |
FileChooserWidget: Fix leaks in .get_subtitle()
Now that subtitle's default value "Searching" for OPERATION_MODE_SEARCH
is duplicated as it should be, we cannot reassign other strings to it
anymore, as that resulted in the original dupe of "Searching" leaking.
Fix this by only assigning the dup'd "Searching" after trying to get
more specific values, not before. We therefore need to set it to NULL
during its declaration, and that means we needn't in the final else.
-rw-r--r-- | gtk/gtkfilechooserwidget.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index e7e2d96234..d1dd2f0059 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -3265,14 +3265,12 @@ static gchar * gtk_file_chooser_widget_get_subtitle (GtkFileChooserWidget *impl) { GtkFileChooserWidgetPrivate *priv = impl->priv; - gchar *subtitle; + gchar *subtitle = NULL; if (priv->operation_mode == OPERATION_MODE_SEARCH) { gchar *location; - subtitle = g_strdup (_("Searching")); - location = gtk_places_sidebar_get_location_title (GTK_PLACES_SIDEBAR (priv->places_sidebar)); if (location) { @@ -3294,6 +3292,9 @@ gtk_file_chooser_widget_get_subtitle (GtkFileChooserWidget *impl) g_object_unref (info); } } + + if (subtitle == NULL) + subtitle = g_strdup (_("Searching")); } else if (priv->operation_mode == OPERATION_MODE_ENTER_LOCATION || (priv->operation_mode == OPERATION_MODE_BROWSE && @@ -3304,10 +3305,6 @@ gtk_file_chooser_widget_get_subtitle (GtkFileChooserWidget *impl) else subtitle = g_strdup (_("Enter location or URL")); } - else - { - subtitle = NULL; - } return subtitle; } |