Software Development Kit (SDK) and API Discussions

Memory leak in the NMSDK c library

Haihong
1,403 Views

Hi, I recently use the ASAN feature with gcc on our custom binary using NMSDK 9.7, and it detected such memory leak:

 

Indirect leak of 128 byte(s) in 2 object(s) allocated from:

    #0 0x7f963768fb50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)

    #1 0x7f962e858da5  (/lib/x86_64-linux-gnu/libc.so.6+0x103da5)

    #2 0x7f962e85a0a6 in getaddrinfo (/lib/x86_64-linux-gnu/libc.so.6+0x1050a6)

    #3 0x7f963764825a  (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x9725a)

    #4 0x7f962f42c5c5 in na_server_invoke_elem_http /libnetapp/na.c:3575

    #5 0x7f962f42b6c9 in na_server_invoke_elem /libnetapp/na.c:3014

    #6 0x5593aea874e8 in NetAppApiClient::InvokeAPI(int, ScopedNaElem*, ScopedNaElem*) (/tmp/netapp_api_client_main+0x49e4e8)

 

This is consistently being reported when the API above is called. Looks like the memory allocated in getaddrinfo() is not freed (check https://man7.org/linux/man-pages/man3/getaddrinfo.3.html, there needs freeaddrinfo() afterwards). 

 

Is this a known issue? The fix seems to be straightforward if this is confirmed a legitimate memory leak.

 

By the way, is the netapp SDK source code public (and people can make contribution to)?

1 REPLY 1

wdiane
1,085 Views

Please reach out to dl-sdk-answers@netapp.com

Public