From 0797d16af007bc4dd2fabe557ba62f7fa83dee93 Mon Sep 17 00:00:00 2001
From: aschrijver <aschrijver@cvs.openbsd.org>
Date: Sat, 27 Dec 2008 19:46:13 +0000
Subject: Fix memory leak.

---
 usr.sbin/ypldap/aldap.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

(limited to 'usr.sbin')

diff --git a/usr.sbin/ypldap/aldap.c b/usr.sbin/ypldap/aldap.c
index 816b2d5bc36..84bf03af9f1 100644
--- a/usr.sbin/ypldap/aldap.c
+++ b/usr.sbin/ypldap/aldap.c
@@ -1,5 +1,5 @@
-/*	$Id: aldap.c,v 1.7 2008/11/28 10:07:56 aschrijver Exp $ */
-/*	$OpenBSD: aldap.c,v 1.7 2008/11/28 10:07:56 aschrijver Exp $ */
+/*	$Id: aldap.c,v 1.8 2008/12/27 19:46:12 aschrijver Exp $ */
+/*	$OpenBSD: aldap.c,v 1.8 2008/12/27 19:46:12 aschrijver Exp $ */
 
 /*
  * Copyright (c) 2008 Alexander Schrijver <aschrijver@openbsd.org>
@@ -75,6 +75,8 @@ aldap_bind(struct aldap *ldap, char *binddn, char *bindcred)
 	if(ber_write_elements(&ldap->ber, root) == -1)
 		return (-1);
 
+	ber_free_elements(root);
+
 	return (ldap->msgid);
 }
 
@@ -92,6 +94,8 @@ aldap_unbind(struct aldap *ldap)
 	if(ber_write_elements(&ldap->ber, root) == -1)
 		return (-1);
 
+	ber_free_elements(root);
+
 	return (ldap->msgid);
 }
 
@@ -119,6 +123,8 @@ aldap_search(struct aldap *ldap, char *basedn, enum scope scope, char *filter,
 	if(ber_write_elements(&ldap->ber, root) == -1)
 		return (-1);
 
+	ber_free_elements(root);
+
 	return (ldap->msgid);
 }
 
-- 
cgit v1.2.3