This patch fixes 2 situations where a pointer to allocated error
string could be overwritten - which could have resulted in
a memory leak.

https://fedorahosted.org/freeipa/ticket/714

>From f502f98b82ccd500001c3fecc363435d661162b9 Mon Sep 17 00:00:00 2001
From: Martin Kosek <mko...@redhat.com>
Date: Wed, 12 Jan 2011 14:17:30 +0100
Subject: [PATCH] Potential memory leaks in ipa-getkeytab

This patch fixes 2 situations where a pointer to allocated error
string could be overwritten - which could have resulted in
a memory leak.

https://fedorahosted.org/freeipa/ticket/714
---
 ipa-client/ipa-getkeytab.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/ipa-client/ipa-getkeytab.c b/ipa-client/ipa-getkeytab.c
index 8f108de4a5edb9f353c172a338838e504e842ca5..58ad4375084cfa56de855fe81ab50cbab626fa89 100644
--- a/ipa-client/ipa-getkeytab.c
+++ b/ipa-client/ipa-getkeytab.c
@@ -233,6 +233,7 @@ static int prep_ksdata(krb5_context krbctx, const char *str,
                                             &similar);
             if (krberr) {
                 free_keys_contents(krbctx, keys);
+                free(ksdata);
                 fprintf(stderr, _("Enctype comparison failed!\n"));
                 return 0;
             }
@@ -695,6 +696,7 @@ static int ldap_set_keytab(krb5_context krbctx,
 	ldap_controls_free(srvctrl);
 	ldap_msgfree(res);
 	ldap_unbind_ext(ld, NULL, NULL);
+	free(encs);
 	return kvno;
 
 error_out:
-- 
1.7.3.4

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to