]> git.sur5r.net Git - openldap/commitdiff
Plug memleak on mismatched length
authorHoward Chu <hyc@openldap.org>
Mon, 13 Jul 2015 16:17:42 +0000 (17:17 +0100)
committerHoward Chu <hyc@openldap.org>
Mon, 13 Jul 2015 16:17:42 +0000 (17:17 +0100)
contrib/slapd-modules/passwd/totp/slapd-totp.c

index 9934fdffcf88afeeafb6addf7000853ac9ac4cda..14f4d92c00d7db194098c282b9ef76378e2567cb 100644 (file)
@@ -425,8 +425,10 @@ static int chk_totp(
        memset(key.mv_val, 0, key.mv_len);
 
        /* compare */
-       if (out.mv_len != cred->bv_len)
-               return LUTIL_PASSWD_ERR;
+       if (out.mv_len != cred->bv_len) {
+               rc = LUTIL_PASSWD_ERR;
+               goto out;
+       }
 
        rc = memcmp(out.mv_val, cred->bv_val, out.mv_len) ? LUTIL_PASSWD_ERR : LUTIL_PASSWD_OK;