[Webkit-unassigned] [Bug 191498] [Curl] implement CertificateInfo::summaryInfo

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jul 11 06:55:26 PDT 2019


https://bugs.webkit.org/show_bug.cgi?id=191498

--- Comment #21 from Fujii Hironori <Hironori.Fujii at sony.com> ---
Comment on attachment 373889
  --> https://bugs.webkit.org/attachment.cgi?id=373889
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=373889&action=review

>> Source/WebCore/platform/network/curl/CertificateInfoCurl.cpp:76
>> +    auto commonName = OpenSSL::createPtr<uint8_t>();
> 
> Looks so bad. The previous your code looks better: OpenSSL::Ptr commonName;
> You can specify a lambda as deleter of std::unique_ptr. Google "lambda deleter std::unique_ptr".
> You can improve more.

Sorry, I didn't understand the problem.
Now I understand why we shouldn't use std::unique_ptr for this purpose.

What about the following code?:

static auto toASN1String(const X509_NAME* name)
{
    auto deleter = [](unsigned char* ptr) {
                       if (ptr)
                           free(ptr);
    };
    unsigned char* buffer;
    ASN1_STRING_to_UTF8(&buffer, name);
    return std::unique_ptr<unsigned char[], decltype(deleter)>(buffer, deleter);
}

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190711/46b6e7ae/attachment.html>


More information about the webkit-unassigned mailing list