From 1cbb2441d80cb94f51193b10affe977193e077a8 Mon Sep 17 00:00:00 2001
From: Andrea Zagli <azagli@libero.it>
Date: Mon, 4 Dec 2017 17:19:47 +0100
Subject: [PATCH] Wrong GSList allocation for parameters to pass to zakauthe.

---
 src/mod_authn_zakauthe.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/mod_authn_zakauthe.c b/src/mod_authn_zakauthe.c
index d058437..6f312e6 100644
--- a/src/mod_authn_zakauthe.c
+++ b/src/mod_authn_zakauthe.c
@@ -80,12 +80,20 @@ check_password (request_rec *r,
 
 	ZakAuthe *authe;
 	GSList *sl_authe_params;
+	GSList *sl_loop;
 
 	zakauthe_config *config = (zakauthe_config *)ap_get_module_config (r->per_dir_config, &authn_zakauthe_module);
 
 	sl_authe_params = NULL;
-	sl_authe_params = g_slist_append (sl_authe_params, config->plugin_name);
-	sl_authe_params = g_slist_concat (sl_authe_params, config->sl_options);
+	sl_authe_params = g_slist_append (sl_authe_params, g_strdup (config->plugin_name));
+
+	sl_loop = g_slist_nth (config->sl_options, 0);
+	while (sl_loop != NULL)
+		{
+			sl_authe_params = g_slist_append (sl_authe_params, g_strdup ((const gchar *)sl_loop->data));
+
+			sl_loop = g_slist_next (sl_loop);
+		}
 
 	authe = zak_authe_new ();
 
@@ -106,7 +114,7 @@ check_password (request_rec *r,
 		}
 
 	g_object_unref (authe);
-	g_slist_free (sl_authe_params);
+	g_slist_free_full (sl_authe_params, g_free);
 
 	return ret;
 }
-- 
2.49.0