Uploaded image for project: 'Apache Knox'
  1. Apache Knox
  2. KNOX-748

Fix Resource Leak in X509CertificateUtil.writeCertificateToJKS

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.10.0
    • Server
    • None

    Description

      New defect(s) Reported-by: Coverity Scan
      Showing 1 of 1 defect(s)

        • CID 1361992: Exceptional resource leaks (RESOURCE_LEAK)
          /gateway-spi/src/main/java/org/apache/hadoop/gateway/services/security/impl/X509CertificateUtil.java: 299 in org.apache.hadoop.gateway.services.security.impl.X509CertificateUtil.writeCertificateToJKS(java.security.cert.Certificate, java.io.File)()

      ________________________________________________________________________________________________________

          • CID 1361992: Exceptional resource leaks (RESOURCE_LEAK)
            /gateway-spi/src/main/java/org/apache/hadoop/gateway/services/security/impl/X509CertificateUtil.java: 299 in org.apache.hadoop.gateway.services.security.impl.X509CertificateUtil.writeCertificateToJKS(java.security.cert.Certificate, java.io.File)()
            293
            294 char[] password = "changeme".toCharArray();
            295 ks.load(null, password);
            296 ks.setCertificateEntry("gateway-identity", cert);
            297
            298 FileOutputStream fos = new FileOutputStream(file);
            CID 1361992: Exceptional resource leaks (RESOURCE_LEAK)
            Variable "fos" going out of scope leaks the resource it refers to.
            299 ks.store(fos, password);
            300 fos.close();
            301 }

      Attachments

        1. KNOX-748.001.patch
          1 kB
          Sandeep More

        Activity

          People

            smore Sandeep More
            lmccay Larry McCay
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: