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

memory leak in QSslCertificate::subjectAlternativeNames?

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.7.1
    • Fix Version/s: 5.11.1
    • Component/s: Network: SSL
    • Labels:
      None
    • Commits:
      8d7edf18ebd4bb4cf110000afb1b5a8b1f3887a4

      Description

      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));
      

        Attachments

          Issue Links

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

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes