Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-57679

memory leak in QSslCertificate::subjectAlternativeNames?

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • 5.11.1
    • 5.7.1
    • Network: SSL
    • None
    • 8d7edf18ebd4bb4cf110000afb1b5a8b1f3887a4

      In qtbase/src/network/ssl/qsslcertificate_openssl.cpp you have

      QMultiMap<QSsl::AlternativeNameEntryType, QString> QSslCertificate::subjectAlternativeNames() const
      {
          STACK_OF(GENERAL_NAME) *altNames = (STACK_OF(GENERAL_NAME)*)q_X509_get_ext_d2i(d->x509, NID_subject_alt_name, 0, 0);
      
          if (altNames) {
              for (int i = 0; i < q_sk_GENERAL_NAME_num(altNames); ++i) {
                  const GENERAL_NAME *genName = q_sk_GENERAL_NAME_value(altNames, i);
      ...
              }
              q_sk_pop_free((STACK*)altNames, reinterpret_cast<void(*)(void*)>(q_sk_free));
          }
      
          return result;
      }
      

      It seems you have to do q_sk_pop_free in such way:

      sk_pop_free((STACK *)altNames, reinterpret_cast<void (*)(void *)>(GENERAL_NAME_free));
      

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            tpochep Timur Pocheptsov
            dimanne DimanNe
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes