Use-after-free on failure path in LinuxPackage.c, getJvmLauncherLibPath

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 17
    • Affects Version/s: 17
    • Component/s: tools
    • b09

      SonarCloud instance reports a new warning after JDK-8254702:
       "Use of memory after it is freed"

      char* getJvmLauncherLibPath(void) {
             ...
              popenStatus = popenCommand(pkgQueryCmd, pkg->name, findLauncherLib,
                                                              &launcherLibPath);
              if (popenStatus) {
                  free(launcherLibPath); <---- frees here
                  goto cleanup;
              }
          }

      cleanup:
          free(modulePath);
          freePackageDesc(pkg);

          return launcherLibPath; <--- here
      }

            Assignee:
            Aleksey Shipilev
            Reporter:
            Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: