[PATCH] Fix a CID resource leak

Volker Lendecke Volker.Lendecke at SerNet.DE
Tue Jun 19 08:25:08 UTC 2018


Hi!

Review appreciated!

Thanks, Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
From 5eccdb0780101e40f6941b754947cc104d9ad810 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 19 Jun 2018 10:20:11 +0200
Subject: [PATCH] heimdal: Fix CID 1437405 Resource leaks

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source4/heimdal/lib/krb5/config_file.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/source4/heimdal/lib/krb5/config_file.c b/source4/heimdal/lib/krb5/config_file.c
index 05f97eb6d1d..7bc3f35b8b4 100644
--- a/source4/heimdal/lib/krb5/config_file.c
+++ b/source4/heimdal/lib/krb5/config_file.c
@@ -459,12 +459,16 @@ krb5_config_parse_dir_multi(krb5_context context,
             continue;
 
         if (asprintf(&path, "%s/%s", dname, entry->d_name) == -1 ||
-            path == NULL)
+            path == NULL) {
+            (void)closedir(d);
             return krb5_enomem(context);
+	}
         ret = krb5_config_parse_file_multi(context, path, res);
         free(path);
-        if (ret == ENOMEM)
+        if (ret == ENOMEM) {
+            (void)closedir(d);
             return krb5_enomem(context);;
+	}
         /* Ignore malformed config files */
     }
     (void) closedir(d);
-- 
2.11.0



More information about the samba-technical mailing list