From 56447baf3bca6cc7110420d84188291f6c785daf Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 7 Jun 2008 08:48:13 +0200 Subject: [PATCH] Fix a memleak in fetch_ldap_pw Fix Coverity ID 572, also fix the error check for secrets_fetch failing (cherry picked from commit 2663c81a782fd4394a9feaaaa987c7f6d38ca5da) --- source/passdb/secrets.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/passdb/secrets.c b/source/passdb/secrets.c index 34a87bd0d0e..04603fdf093 100644 --- a/source/passdb/secrets.c +++ b/source/passdb/secrets.c @@ -883,10 +883,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; } -- 2.11.4.GIT