From 9a353ac7f84a2b6485dd1bb1b272cb8405bd4e9e Mon Sep 17 00:00:00 2001
From: Arthur de Jong <arthur@arthurdejong.org>
Date: Tue, 27 Aug 2024 21:39:21 +0200
Subject: [PATCH] Fix memory leak in config parsing

This fixes a one-time memory leak in reading the base configuration
option.
---
 nslcd/cfg.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/nslcd/cfg.c b/nslcd/cfg.c
index 86917d5..6e56161 100644
--- a/nslcd/cfg.c
+++ b/nslcd/cfg.c
@@ -685,7 +685,10 @@ static void handle_base(const char *filename, int lnr,
 #endif /* not HAVE_LDAP_DOMAIN2DN */
   }
   if (strcasecmp(value, "\"\"") == 0)
+  {
+    free(value);
     value = "";
+  }
   /* find the spot in the list of bases */
   for (i = 0; i < NSS_LDAP_CONFIG_MAX_BASES; i++)
     if (bases[i] == NULL)
-- 
2.33.0

