On Sunday 08 January 2017 07:59:34 Shuo Chen wrote: > Valgrind finds out that conninfo->servername is not free()d by > tls_conninfo_free(). > > == HEAP SUMMARY: > == in use at exit: 83,069 bytes in 2,690 blocks > == total heap usage: 4,107 allocs, 1,417 frees, > == 339,660 bytes allocated > == > == 17 bytes in 1 blocks are definitely lost in loss record 1 of 266 > == at 0x4C28C20: malloc (vg_replace_malloc.c:296) > == by 0x58F5989: strdup (strdup.c:42) > == by 0x40B2C4: tls_conninfo_populate > == by 0x408C4F: tls_handshake > == by 0x403691: TlsContext::handshake() > == by 0x403343: TlsStream::connect(TlsConfig*, char const*, > == by 0x407781: main (in /home/schen/recipes/ssl/client) > == > == LEAK SUMMARY: > == definitely lost: 17 bytes in 1 blocks > == indirectly lost: 0 bytes in 0 blocks > == possibly lost: 0 bytes in 0 blocks > == still reachable: 83,052 bytes in 2,689 blocks > == suppressed: 0 bytes in 0 blocks > > Here's a quick fix.
Committed, thanks! > ==================================================== > diff --git a/tls/tls_conninfo.c b/tls/tls_conninfo.c > --- a/tls/tls_conninfo.c > +++ b/tls/tls_conninfo.c > @@ -248,6 +248,8 @@ tls_conninfo_free(struct tls_conninfo *conninfo) > conninfo->alpn = NULL; > free(conninfo->cipher); > conninfo->cipher = NULL; > + free(conninfo->servername); > + conninfo->servername = NULL; > free(conninfo->version); > conninfo->version = NULL;
