Hi,
On Thu, Feb 22, 2018 at 4:47 PM, Steffan Karger <[email protected]> wrote:
> Hi,
>
> On 26-01-18 16:53, [email protected] wrote:
>> From: Selva Nair <[email protected]>
>>
>> - Also add reference counting to CAPI_DATA (application data):
>>
>> When the application data is assigned to the private key
>> we free it in the key's finish method. Proper error handling
>> requires to keep track of whether data is assigned to the
>> key or not before an error occurs. For this purpose, add a
>> reference count to CAPI_DATA struct and increment it when it is
>> assigned to the key or its method.
>>
..
>> - /* SSL_CTX_use_RSAPrivateKey() increased the reference count in 'rsa',
>> so
>> - * we decrease it here with RSA_free(), or it will never be cleaned up.
>> */
>> - RSA_free(rsa);
>> + cd->ref_count--; /* so that cd will get freed with the private key */
>
> Would a call to CAPI_DATA_free() - effectively the same - not be more
> clear? I'll let you decide, I'm okay with this too.
Very true. I wonder why I didn't write it so in the first place.. Will
ponder a bit and do a v3.
>
>> return 1;
>>
>> err:
>> - if (cert)
>> - {
>> - X509_free(cert);
>> - }
>> - if (rsa)
>> - {
>> - RSA_free(rsa);
>> - }
>> - else
>> - {
>> - if (my_rsa_method)
>> - {
>> - free(my_rsa_method);
>> - }
>> - CAPI_DATA_free(cd);
>> - }
>> + CAPI_DATA_free(cd);
>> return 0;
>> }
>>
>>
>
> Code looks good, and works as expected on my Win10 test machine.
>
> Accepted-by: Steffan Karger <[email protected]>
Wonder what "Accepted-by" does on patchwork...
Thanks for the review.
Selva
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel