Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8266187

Memory leak in appendBootClassPath()

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 17
    • Fix Version/s: 17
    • Component/s: core-svc
    • Labels:

      Description

      In this code:

      936 } else {
      937 char* resolved;
      938
      939 if (!haveBasePath) {
      940 if (JDK_Canonicalize((char*)jarfile, canonicalPath, sizeof(canonicalPath)) != 0) {
      941 fprintf(stderr, "WARNING: unable to canonicalize %s\n", jarfile);
      942 free(path);
      943 continue;
      944 }
      945 parent = basePath(canonicalPath);
      946 jplis_assert(parent != (char*)NULL);
      947 haveBasePath = 1;
      948 }
      949
      950 resolved = resolve(parent, path); // malloc resolved here
      951 jvmtierr = (*jvmtienv)->AddToBootstrapClassLoaderSearch(jvmtienv, resolved); // use resolved here
      952 }

      Here, we malloc() resolved in line 950 without free(). It is a memory leak, so let's fix it.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              whuang Wang Huang
              Reporter:
              whuang Wang Huang
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: