Jump to content

Recommended Posts

OverbyteIcsWSocket.pas has at least one small memory leak.

 

In line 17009 (SVN 1464), an X509Obj is duplicated before its is added to the list. However, TX509Base.Create() duplicates the duplication once more before TX509List.Add() stores it to the list. The first duplicated object is never freed, resulting in the leak.

 

This is the line in question:

CertList.Add(f_X509_dup(f_X509_OBJECT_get0_X509 (MyX509Obj)));

The fix is to remove f_X509_dup(), so the line looks like this:

CertList.Add(f_X509_OBJECT_get0_X509 (MyX509Obj));

Code analysis suggests that a similar leak is present in line 15012, but I have not been able to trigger this code running one of the Sample projects:

Cert.AddToInters(f_X509_dup(f_X509_OBJECT_get0_X509 (MyX509Obj)));

Ralf

Edited by Ralf Junker

Share this post


Link to post

Thanks, I did see an exception recently rebuilding stacks of root certificates to check chains, the quick solution was to avoid rebuilding stacks (which was also more efficient), but this is probably the root cause, will fix it. 

 

Angus

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×