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

Memory leak issue on awt_InputMethod.c

XMLWordPrintable

    • b17
    • generic
    • linux, aix

        Memory leak issue on awt_InputMethod.c.

        See src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c.
        On line 1117, memory area was allocated by malloc(), but free() is missing
        ===========================================
          1099 if (text->feedback != NULL) {
          1100 int cnt;
          1101 jint *tmpstyle;
          1102
          1103 style = (*env)->NewIntArray(env, text->length);
          1104 if (JNU_IsNull(env, style)) {
          1105 (*env)->ExceptionClear(env);
          1106 THROW_OUT_OF_MEMORY_ERROR();
          1107 goto finally;
          1108 }
          1109
          1110 if (sizeof(XIMFeedback) == sizeof(jint)) {
          1111 /*
          1112 * Optimization to avoid copying the array
          1113 */
          1114 (*env)->SetIntArrayRegion(env, style, 0,
          1115 text->length, (jint *)text->feedback);
          1116 } else {
          1117 tmpstyle = (jint *)malloc(sizeof(jint)*(text->length));
          1118 if (tmpstyle == (jint *) NULL) {
          1119 THROW_OUT_OF_MEMORY_ERROR();
          1120 goto finally;
          1121 }
          1122 for (cnt = 0; cnt < (int)text->length; cnt++)
          1123 tmpstyle[cnt] = text->feedback[cnt];
          1124 (*env)->SetIntArrayRegion(env, style, 0,
          1125 text->length, (jint *)tmpstyle);
          1126 }
          1127 }
        ===========================================

        RFR:
        http://mail.openjdk.java.net/pipermail/awt-dev/2018-October/014390.html

        Reviewers
        http://mail.openjdk.java.net/pipermail/awt-dev/2018-October/014391.html
        http://mail.openjdk.java.net/pipermail/awt-dev/2018-October/014415.html

              itakiguchi Ichiroh Takiguchi (Inactive)
              itakiguchi Ichiroh Takiguchi (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: