Description of problem: schema reload test in TET run with valgrind reports this leak: ==20763== 1,375,233 (398,792 direct, 976,441 indirect) bytes in 2,463 blocks are definitely lost in loss record 61 of 62 ==20763== at 0x4A05414: calloc (vg_replace_malloc.c:397) ==20763== by 0x4C5063D: slapi_ch_calloc (ch_malloc.c:243) ==20763== by 0x4C5FEAA: slapi_entry_alloc (entry.c:1695) ==20763== by 0x4C5DCF9: str2entry_dupcheck (entry.c:631) ==20763== by 0x4C5EECB: slapi_str2entry (entry.c:1142) ==20763== by 0x4C58FB7: dse_read_one_file (dse.c:739) ==20763== by 0x4C59259: dse_read_file (dse.c:811) ==20763== by 0x4CB6D61: init_schema_dse_ext (schema.c:4168) ==20763== by 0x4CB805D: slapi_validate_schema_files (schema.c:4894) ==20763== by 0xC555F96: schemareload_thread (schema_reload.c:146) ==20763== by 0x32B7429262: (within /lib64/libnspr4.so) ==20763== by 0x37A6406869: start_thread (in /lib64/libpthread-2.10.1.so) ==20763== by 0x37A58DE3BC: clone (in /lib64/libc-2.10.1.so)
DSE initialized in init_schema_dse usually does not get released... ==18156== 9,856 (2,352 direct, 7,504 indirect) bytes in 28 blocks are definitely lost in loss record 1,426 of 1,451 ==18156== at 0x4004F1B: calloc (vg_replace_malloc.c:418) ==18156== by 0x40382D1: slapi_ch_calloc (ch_malloc.c:243) ==18156== by 0x4047EFD: slapi_entry_alloc (entry.c:1695) ==18156== by 0x4045FF1: str2entry_dupcheck (entry.c:631) ==18156== by 0x4046FC8: slapi_str2entry (entry.c:1142) ==18156== by 0x40413B7: dse_read_one_file (dse.c:739) ==18156== by 0x4041633: dse_read_file (dse.c:811) ==18156== by 0x409AEBE: init_schema_dse_ext (schema.c:4168) ==18156== by 0x409B161: init_schema_dse (schema.c:4232) ==18156== by 0x805F435: setup_internal_backends (in /usr/sbin/ns-slapd) ==18156== by 0x80611BD: main (in /usr/sbin/ns-slapd)
Created attachment 396201 [details] git patch file Files: ldap/servers/slapd/dse.c ldap/servers/slapd/schema.c Description: dse.c: 1) dse_add_entry_pb is supposed to free the given the schema entry e. Although the function never consumes the entry, it was only freeing it when the entry was added. (If it was merged or rejected, it was not freed.) schema.c: 1) when allocating a work buffer with sizedbuffer_allocate, the space for the NULL termination was not counted. 2) DSE returned from slapi_validate_schema_files must have been freed regardless of the return value.
Reviewed by Rich (Thank you!!!) Pushed to master: $ git merge work Updating 2cc5ac4..2c28527 Fast forward ldap/servers/slapd/dse.c | 13 ++++++++----- ldap/servers/slapd/schema.c | 8 +++++--- 2 files changed, 13 insertions(+), 8 deletions(-) $ git push Counting objects: 13, done. Delta compression using 4 threads. Compressing objects: 100% (7/7), done. Writing objects: 100% (7/7), 1.19 KiB, done. Total 7 (delta 5), reused 0 (delta 0) To ssh://git.fedorahosted.org/git/389/ds.git 2cc5ac4..2c28527 master -> master Pushed to Directory_Server_8_2_Branch $ git push origin ds82-local:Directory_Server_8_2_Branch Counting objects: 13, done. Delta compression using 4 threads. Compressing objects: 100% (7/7), done. Writing objects: 100% (7/7), 1.19 KiB, done. Total 7 (delta 5), reused 0 (delta 0) To ssh://git.fedorahosted.org/git/389/ds.git 0e888ff..9f3536c ds82-local -> Directory_Server_8_2_Branch
Created attachment 419148 [details] valgrind logs
please review attached valgrind logs for memory leak fix. Thanks!
None of these are the original leak, so we can declare this as verified.
verified - RHEL 4 version: redhat-ds-base-8.2.0-2010060204.el4dsrv Thank you Rich