I tested it again and found that there is not memory leak on gcc 4.1.2 and openssl 0.9.8c. The leak version is on gcc 3.3.5 and OpenSSL 0.9.7d. So, it may be not a bug of openLDAP but the other old version software.