Re: Advice on a memory issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On 16 May 2019, at 17:18, thierry bordaz <tbordaz@xxxxxxxxxx> wrote:
> 
> Hi William,
> 
> It looks to me that attr_syntax_create overwrite the allocated asi with one it allocates itself based on provided params.
> In short I think attr_syntax_creates allocates for you the syntaxinfo, you do not need to provide one.
> 

AHHHHh how did I miss this!!! I was staring attr_syntax_create for most of the morning yesterday! 

Anyway, thank you, I have fixed that up - back to writing tests now ... 

> best regards
> thierry
> On 5/16/19 8:17 AM, William Brown wrote:
>> https://pagure.io/389-ds-base/pull-request/50379
>> 
>> 
>> This code is not yet ready to be merged. I'm currently having a problem with freeing the attrsyntaxinfo struct as part of the test.
>> 
>> If the code is as is I get:
>> 
>> 
>> =================================================================
>> ==98363==ERROR: LeakSanitizer: detected memory leaks
>> 
>> Direct leak of 160 byte(s) in 1 object(s) allocated from:
>>     #0 0x7fbc40e28538 in calloc (/usr/lib64/libasan.so.5+0xec538)
>>     #1 0x7fbc40a34be6 in slapi_ch_calloc /home/william/development/389ds/ds/ldap/servers/slapd/ch_malloc.c:175
>>     #2 0x40499c in attr_syntax_add_from_name /home/william/development/389ds/ds/test/libslapd/schema/filter_validate.c:25
>>     #3 0x404b22 in test_libslapd_schema_filter_validate_simple /home/william/development/389ds/ds/test/libslapd/schema/filter_validate.c:56
>>     #4 0x7fbc40d340d8  (/usr/lib64/libcmocka.so.0+0x50d8)
>> 
>> Objects leaked above:
>> 0x60e000000d60 (160 bytes)
>> 
>> Direct leak of 160 byte(s) in 1 object(s) allocated from:
>>     #0 0x7fbc40e28538 in calloc (/usr/lib64/libasan.so.5+0xec538)
>>     #1 0x7fbc40a34be6 in slapi_ch_calloc /home/william/development/389ds/ds/ldap/servers/slapd/ch_malloc.c:175
>>     #2 0x40499c in attr_syntax_add_from_name /home/william/development/389ds/ds/test/libslapd/schema/filter_validate.c:25
>>     #3 0x404b0f in test_libslapd_schema_filter_validate_simple /home/william/development/389ds/ds/test/libslapd/schema/filter_validate.c:55
>>     #4 0x7fbc40d340d8  (/usr/lib64/libcmocka.so.0+0x50d8)
>> 
>> Objects leaked above:
>> 0x60e000000ba0 (160 bytes)
>> 
>> SUMMARY: AddressSanitizer: 320 byte(s) leaked in 2 allocation(s).
>> 
>> However, if I free *a and *b, with attr_syntax_free, or slapi_ch_free, I get a double free error. The size of 160 bytes correlates to the sizeof(struct attrsyntaxinfo) but looking in gdb during attr_syntax_delete, the attr_syntax_free is called on asi as provided.
>> 
>> So I'm not 100% sure what's going wrong here, but I'm not thoroughly experienced in this part of the code, so feedback would be really helpful about this resource issue.
>> 
>> Thanks! 
>> 
>> —
>> Sincerely,
>> 
>> William Brown
>> 
>> Senior Software Engineer, 389 Directory Server
>> SUSE Labs
>> _______________________________________________
>> 389-devel mailing list -- 
>> 389-devel@xxxxxxxxxxxxxxxxxxxxxxx
>> 
>> To unsubscribe send an email to 
>> 389-devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
>> 
>> Fedora Code of Conduct: 
>> https://getfedora.org/code-of-conduct.html
>> 
>> List Guidelines: 
>> https://fedoraproject.org/wiki/Mailing_list_guidelines
>> 
>> List Archives: 
>> https://lists.fedoraproject.org/archives/list/389-devel@xxxxxxxxxxxxxxxxxxxxxxx
> 

—
Sincerely,

William Brown

Senior Software Engineer, 389 Directory Server
SUSE Labs
_______________________________________________
389-devel mailing list -- 389-devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to 389-devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/389-devel@xxxxxxxxxxxxxxxxxxxxxxx




[Index of Archives]     [Fedora Directory Announce]     [Fedora Users]     [Older Fedora Users Mail]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Review]     [Fedora Art]     [Fedora Music]     [Fedora Packaging]     [CentOS]     [Fedora SELinux]     [Big List of Linux Books]     [KDE Users]     [Fedora Art]     [Fedora Docs]

  Powered by Linux