From 32452565be35ef517356ba7ac10e54e65319c829 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 7 Jun 2008 08:48:13 +0200 Subject: Fix a memleak in fetch_ldap_pw Fix Coverity ID 572, also fix the error check for secrets_fetch failing (This used to be commit 2663c81a782fd4394a9feaaaa987c7f6d38ca5da) --- source3/passdb/secrets.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/passdb/secrets.c') diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c index a7223b7e9f..d6a0e89bba 100644 --- a/source3/passdb/secrets.c +++ b/source3/passdb/secrets.c @@ -884,10 +884,11 @@ bool fetch_ldap_pw(char **dn, char** pw) if (*p == ',') *p = '/'; data=(char *)secrets_fetch(old_style_key, &size); - if (!size && size < sizeof(old_style_pw)) { + if ((data == NULL) || (size < sizeof(old_style_pw))) { DEBUG(0,("fetch_ldap_pw: neither ldap secret retrieved!\n")); SAFE_FREE(old_style_key); SAFE_FREE(*dn); + SAFE_FREE(data); return False; } -- cgit