From 607c2d7441b5b56272765dfd6ee56de983c3b407 Mon Sep 17 00:00:00 2001
From: Mark Andrews <marka@isc.org>
Date: Fri, 19 Oct 2018 19:23:39 +1100
Subject: [PATCH 2865/3677] free key on error

---
 lib/dns/dst_api.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/dns/dst_api.c b/lib/dns/dst_api.c
index 7685dcb..c0684d9 100644
--- a/lib/dns/dst_api.c
+++ b/lib/dns/dst_api.c
@@ -802,6 +802,9 @@ dst_key_fromgssapi(const dns_name_t *name, gss_ctx_id_t gssctx,
 	*keyp = key;
 	result = ISC_R_SUCCESS;
 out:
+	if (result != ISC_R_SUCCESS) {
+		dst_key_free(&key);
+	}
 	return result;
 }
 
-- 
1.8.3.1

