From: stsp Date: Tue, 6 Oct 2015 14:02:25 +0000 (+0000) Subject: Fix buf leak in error path. ok gilles@ eric@ X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f011c38568207ebfd26e948f629e794f763aca44;p=openbsd Fix buf leak in error path. ok gilles@ eric@ --- diff --git a/usr.sbin/smtpd/table_ldap.c b/usr.sbin/smtpd/table_ldap.c index 0b9b7451e79..5cc48f76b78 100644 --- a/usr.sbin/smtpd/table_ldap.c +++ b/usr.sbin/smtpd/table_ldap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: table_ldap.c,v 1.13 2015/01/20 17:37:54 deraadt Exp $ */ +/* $OpenBSD: table_ldap.c,v 1.14 2015/10/06 14:02:25 stsp Exp $ */ /* * Copyright (c) 2013 Eric Faurot @@ -189,10 +189,10 @@ ldap_connect(const char *addr) if ((buf = strdup(addr)) == NULL) return (NULL); - /* XXX buf leak */ - + /* aldap_parse_url frees buf on success */ if (aldap_parse_url(buf, &lu) != 1) { log_warnx("warn: table-ldap: ldap_parse_url fail"); + free(buf); return (NULL); }