Hi All,

We are experiencing memory leak for memory allocation through
ldap_parse_result call.
In our code we call ldap_parse_result with following parameters
  parse_rc = ldap_parse_result(ld, result, &retCode,
                                            NULL, &AdditionalErrMsg,
                                            NULL, NULL, 0);

We clean up the above call as follows
 // Free LDAP message explicitly
 OB_LDAP_MSGFREE(result);
 OB_LDAP_MEMFREE(AdditionalErrMsg);

We are not sure why the ldap_parse_result is leaking memory. Could
anyone help us on this?

We are trying to develop a standalone code to simulate the leak that
we are facing with our code
We have a standalone code, which does a  asynchronous bind through
ldap handle and then we fire a search.
We see a memory leak in this sample code with stack traces as follows


--------------
MLK: 12 bytes leaked at 0x97f20
  * This memory was allocated from:
    malloc         [rtlib.o]
    calloc         [rtlib.o]
    set_ld_error   [open.c:296]
    ldap_set_lderrno [error.c:279]
    nsldapi_send_server_request [request.c:371]
    nsldapi_send_initial_request [request.c:147]
    simple_bind_nolock [sbind.c:149]
    ldap_simple_bind [sbind.c:79]
    obldap_simple_bind [obldap_wrapper.c:19]
    main           [Search.cpp:36]
    _start         [crt1.o]

MLK: 2 bytes leaked in 2 blocks
  * This memory was allocated from:
    malloc         [rtlib.o]
    nslberi_malloc [io.c:1517]
    ber_get_stringa [decode.c:279]
    ber_scanf      [decode.c:463]
    nsldapi_parse_result [error.c:434]
    ldap_parse_result [error.c:335]
    obldap_parse_result [obldap_wrapper.c:119]
    main           [Search.cpp:136]
    _start         [crt1.o]
  * Block of 1 byte (2 times); last block at 0x9d6c0
----------


Could some please let us know what changes are required to make the
ldap_parse_result error free?

Thanks,
Vijay

_______________________________________________
dev-tech-ldap mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-ldap

Reply via email to