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

Memory leak in Java_java_lang_ClassLoader_defineClass0 with long class names

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 15, 16, 17
    • Fix Version/s: 17
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Introduced In Version:
      15
    • Resolved In Build:
      b09

      Description

      In code that was added by JDK-8238358 there's a potentially malloc'ed string that is never freed.

          utfName = getUTF(env, name, buf, sizeof(buf));

      The solution is to do what _defineClass1 and _defineClass2 is already doing and free utfName after use if it's non-NULL and different from buf (getUTF returns buf if the string fits):

          if (utfName != NULL && utfName != buf) {
              free(utfName);
          }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              redestad Claes Redestad
              Reporter:
              redestad Claes Redestad
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: