Hi all, I am trying to debug a memory leak caused by X509_dup() and was wondering if any body could offer some tips of how to troubleshoot this further.
Basically, I have a template X509 structure, which I'm using as a base for generating new X509 structures. A brief example of what I am doing is as follows: X509 *clone; X509 *template; template = load_template(); clone = X509_dup(template); X509_set_issuer_name(clone, ...); SSL_use_certificate(ssl, clone); X509_free(template); X509_free(clone); Valgrind complains tho that I'm leaking memory somewhere and I dont quite understand it. I am assuming that X509_dup() resets the reference count to 1 on the cloned certificate? Any help is much appreciated. ==4850== 3,060 (528 direct, 2,532 indirect) bytes in 22 blocks are definitely lost in loss record 52 of 71 ==4850== at 0x4C24CEE: malloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so) ==4850== by 0x60048F9: default_malloc_ex (mem.c:79) ==4850== by 0x6004D82: CRYPTO_malloc (mem.c:328) ==4850== by 0x607AA9D: asn1_item_ex_combine_new (tasn_new.c:191) ==4850== by 0x607AC41: ASN1_item_ex_new (tasn_new.c:85) ==4850== by 0x607D88D: ASN1_item_ex_d2i (tasn_dec.c:399) ==4850== by 0x607CE0A: asn1_template_noexp_d2i (tasn_dec.c:704) ==4850== by 0x607D0F4: asn1_template_ex_d2i (tasn_dec.c:574) ==4850== by 0x607D9D8: ASN1_item_ex_d2i (tasn_dec.c:447) ==4850== by 0x607CF54: asn1_template_noexp_d2i (tasn_dec.c:743) ==4850== by 0x607D1A4: asn1_template_ex_d2i (tasn_dec.c:606) ==4850== by 0x607D9D8: ASN1_item_ex_d2i (tasn_dec.c:447) ==4850== by 0x607DC95: ASN1_item_d2i (tasn_dec.c:134) ==4850== by 0x607103F: ASN1_item_dup (a_dup.c:106) ==4850== by 0x6075C66: X509_dup (x_x509.c:137) Regards -- Brad. ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org