summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-03-23 12:14:33 +0100
committerThomas Haller <thaller@redhat.com>2017-03-23 12:20:47 +0100
commit310958d541a519490f6471640715c8c496de97fe (patch)
tree2e34dbcf7df47b727b8a19a718edb52b1427e85e
parent2ec16667973fd39364676424911910df3a111f19 (diff)
downloadnetwork-manager-applet-310958d541a519490f6471640715c8c496de97fe.tar.gz
libnma: fix uninitialized variable in update_title() ("nma-cert-chooser-button.c")
Fixes: 2644d631afd072f66878799e75c5aa1947510c7a Fixes "src/libnma/nma-cert-chooser-button.c:165:7: error: variable label is used uninitialized whenever if condition is false [-Werror,-Wsometimes-uninitialized]"
-rw-r--r--src/libnma/nma-cert-chooser-button.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/libnma/nma-cert-chooser-button.c b/src/libnma/nma-cert-chooser-button.c
index bf83fc9b..f7e4444f 100644
--- a/src/libnma/nma-cert-chooser-button.c
+++ b/src/libnma/nma-cert-chooser-button.c
@@ -150,7 +150,7 @@ update_title (NMACertChooserButton *button)
GckUriData *data;
GtkTreeIter iter;
GtkTreeModel *model;
- gchar *label;
+ gs_free char *label = NULL;
GError *error = NULL;
model = gtk_combo_box_get_model (GTK_COMBO_BOX (button));
@@ -165,6 +165,7 @@ update_title (NMACertChooserButton *button)
if (data) {
if (!gck_attributes_find_string (data->attributes, CKA_LABEL, &label)) {
if (data->token_info) {
+ g_free (label);
label = g_strdup_printf ( priv->flags & NMA_CERT_CHOOSER_BUTTON_FLAG_KEY
? _("Key in %s")
: _("Certificate in %s"),
@@ -185,11 +186,9 @@ update_title (NMACertChooserButton *button)
label = g_strdup (label);
}
- if (!label)
- label = g_strdup (_("(Unknown)"));
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
- COLUMN_LABEL, label, -1);
- g_free (label);
+ COLUMN_LABEL, label ?: _("(Unknown)"),
+ -1);
}
static void