diff options
author | Bret Lambert <blambert@cvs.openbsd.org> | 2009-07-08 13:13:18 +0000 |
---|---|---|
committer | Bret Lambert <blambert@cvs.openbsd.org> | 2009-07-08 13:13:18 +0000 |
commit | ea8eb0d11c79e034094792f6492e89a739b72530 (patch) | |
tree | e4cf0117f64e84abd642cc0c486cc480006c15a1 /usr.sbin/ypldap/aldap.c | |
parent | 5607c57f266acc52ba74f17857e62611ede3994d (diff) |
Fix memory leak in sarch filter parsing code.
ok pyr@
Diffstat (limited to 'usr.sbin/ypldap/aldap.c')
-rw-r--r-- | usr.sbin/ypldap/aldap.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/usr.sbin/ypldap/aldap.c b/usr.sbin/ypldap/aldap.c index 2c9d47408af..70c096a477a 100644 --- a/usr.sbin/ypldap/aldap.c +++ b/usr.sbin/ypldap/aldap.c @@ -1,5 +1,5 @@ -/* $Id: aldap.c,v 1.19 2009/01/29 11:43:31 aschrijver Exp $ */ -/* $OpenBSD: aldap.c,v 1.19 2009/01/29 11:43:31 aschrijver Exp $ */ +/* $Id: aldap.c,v 1.20 2009/07/08 13:13:17 blambert Exp $ */ +/* $OpenBSD: aldap.c,v 1.20 2009/07/08 13:13:17 blambert Exp $ */ /* * Copyright (c) 2008 Alexander Schrijver <aschrijver@openbsd.org> @@ -781,11 +781,11 @@ ldap_do_parse_search_filter(struct ber_element *prev, char **cpp) if ((parsed_val = parseval(attr_val, len)) == NULL) goto callfail; - if ((elm = - ber_add_nstring(elm, parsed_val, - strlen(parsed_val))) == NULL) - goto callfail; + elm = ber_add_nstring(elm, parsed_val, + strlen(parsed_val)); free(parsed_val); + if (elm == NULL) + goto callfail; ber_set_header(elm, BER_CLASS_CONTEXT, type); if (type == LDAP_FILT_SUBS_FIN) break; @@ -795,10 +795,10 @@ ldap_do_parse_search_filter(struct ber_element *prev, char **cpp) if ((parsed_val = parseval(attr_val, len)) == NULL) goto callfail; - if ((elm = ber_add_nstring(elm, parsed_val, - strlen(parsed_val))) == NULL) - goto callfail; + elm = ber_add_nstring(elm, parsed_val, strlen(parsed_val)); free(parsed_val); + if (elm == NULL) + goto callfail; break; } |