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

Memory leak in Java_java_lang_ClassLoader_defineClass0 with long class names

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 17
    • 15, 16, 17
    • core-libs
    • None
    • 15
    • b09

      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);
          }

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

              Created:
              Updated:
              Resolved: