X509_STORE_add_cert increment reference of passed `x509` cert, `X509_free` must be called to avoid memory leak. This is a back-port of commit c1db1ecd from the master branch.