Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-7923

Coverity static analysis: Resource leaks in ProviderLoaderService (Elytron subsystem)

XMLWordPrintable

      Coverity static-analysis scan found 2 resource leaks in ProviderLoaderService class.

      1)

      https://scan7.coverity.com/reports.htm#v16159/p12663/fileInstanceId=6892104&defectInstanceId=1794528&mergedDefectId=1388484
      Following code is used in `load` method:

      if (provider == null) {
          provider = providerClazz.newInstance();
          if (configurationStreamSupplier != null) {
              try (InputStream is = configurationStreamSupplier.get()) {
                  provider.load(configurationStreamSupplier.get());
              }
          }
      }
      

      The load method should use `is` instance instead of calling the supplier again.

      2)

      https://scan7.coverity.com/reports.htm#v16159/p12663/fileInstanceId=6892104&defectInstanceId=1794527&mergedDefectId=1388483
      Following code is used in `toInputStream` method:

      SecurityActions.doPrivileged((PrivilegedExceptionAction<InputStream>) () -> new FileInputStream(file) );
      return new FileInputStream(file);
      

      There should be probably just:

      return SecurityActions.doPrivileged((PrivilegedExceptionAction<InputStream>) () -> new FileInputStream(file) );
      

            rhn-support-ivassile Ilia Vassilev
            josef.cacek@gmail.com Josef Cacek (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: