Blob Blame History Raw
From 5da6d34e2659f915e830932fd366c635801ecd91 Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose@redhat.com>
Date: Mon, 12 Aug 2019 17:28:20 +0200
Subject: [PATCH] Fix for issue found by Coverity

Related to https://gitlab.freedesktop.org/realmd/adcli/issues/3
---
 library/adenroll.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/library/adenroll.c b/library/adenroll.c
index 53cd812..524663a 100644
--- a/library/adenroll.c
+++ b/library/adenroll.c
@@ -2681,7 +2681,10 @@ adcli_enroll_get_permitted_keytab_enctypes (adcli_enroll *enroll)
 	for (c = 0; cur_enctypes[c] != 0; c++);
 
 	new_enctypes = calloc (c + 1, sizeof (krb5_enctype));
-	return_val_if_fail (new_enctypes != NULL, NULL);
+	if (new_enctypes == NULL) {
+		krb5_free_enctypes (k5, permitted_enctypes);
+		return NULL;
+	}
 
 	n = 0;
 	for (c = 0; cur_enctypes[c] != 0; c++) {
-- 
2.21.0