libnetconf2 icon indicating copy to clipboard operation
libnetconf2 copied to clipboard

Possible memory leak in nc_connect_ssh

Open rabhat31 opened this issue 4 years ago • 3 comments

Hi,

There seems to be a memory leak in nc_connect_ssh. I ran our application over a few days with valgrind enabled and I see this error show up in the report.

We're using libnetconf2 v1.1.26

==517== 55,863 bytes in 523 blocks are indirectly lost in loss record 3,776 of 3,906 ==517== at 0x4CA3E26: malloc (vg_replace_malloc.c:299) ==517== by 0x405CDB6: strndup (strndup.c:7) ==517== by 0x74B3A3C: parse_cpblts (session.c:1243) ==517== by 0x74B6053: nc_recv_client_hello_io (session.c:1340) ==517== by 0x74B6053: nc_handshake_io (session.c:1441) ==517== by 0x74C7094: nc_connect_ssh (session_client_ssh.c:1749)

Do you have any insights into why this might be occurring? I haven't been able to reliably reproduce this yet.

Thanks.

rabhat31 avatar Jun 04 '21 06:06 rabhat31

No, I am not sure but there could be a fix committed so you definitely should try using latest libyang1 revision.

michalvasko avatar Jun 04 '21 11:06 michalvasko

We're currently using libyang v 1.0.225. I did a some cursory digging and it looks like the error is very similar to the one from this issue but with slightly different function calls: https://github.com/CESNET/libnetconf2/issues/30 .

rabhat31 avatar Jun 04 '21 16:06 rabhat31

No, I meant using libnetconf2 from its libyang1 branch, which is the latest version for versions 1.x. And I think it may help because this could have been fixed in 8c2478296cbd6ddd654e27178527a5e2162a0955.

michalvasko avatar Jun 07 '21 05:06 michalvasko