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

Memory leak in Java_java_lang_ClassLoader_defineClass0 with long class names

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 17
    • 15, 16, 17
    • core-libs
    • None
    • 15
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: