743651
From 0b24b7ece288641f1d5d6844d1a42ff30b16511a Mon Sep 17 00:00:00 2001
743651
From: Sumit Bose <sbose@redhat.com>
743651
Date: Wed, 24 Aug 2016 16:19:36 +0200
743651
Subject: [PATCH 2/2] Use strdup() if offset are used
743651
743651
Strings with an offset to the original starting point must be copied
743651
because otherwise they cannot be properly freed later.
743651
---
743651
 library/adenroll.c | 6 +++---
743651
 1 file changed, 3 insertions(+), 3 deletions(-)
743651
743651
diff --git a/library/adenroll.c b/library/adenroll.c
743651
index d1020e9..05885d0 100644
743651
--- a/library/adenroll.c
743651
+++ b/library/adenroll.c
743651
@@ -1318,9 +1318,9 @@ load_keytab_entry (krb5_context k5,
743651
 
743651
 		} else if (!enroll->host_fqdn && _adcli_str_has_prefix (name, "host/") && strchr (name, '.')) {
743651
 			/* Skip host/ prefix */
743651
-			enroll->host_fqdn = name + 5;
743651
-			_adcli_info ("Found host qualified name in keytab: %s", name);
743651
-			name = NULL;
743651
+			enroll->host_fqdn = strdup (name + 5);
743651
+			return_val_if_fail (enroll->host_fqdn != NULL, FALSE);
743651
+			_adcli_info ("Found host qualified name in keytab: %s", enroll->host_fqdn);
743651
 		}
743651
 	}
743651
 
743651
-- 
743651
2.7.4
743651