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

Potential memory leak in sun.util.locale.provider.HostLocaleProviderAdapterImpl.getNumberPattern() on Windows

    XMLWordPrintable

Details

    Backports

      Description

        File: java.base/windows/native/libjava/HostLocaleProviderAdapter_md.c

        The native method: Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getNumberPattern(...) {

        ...
            langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
            CHECK_NULL_RETURN(langtag, NULL);
            pattern = getNumberPattern(langtag, numberStyle);
            CHECK_NULL_RETURN(pattern, NULL);

            (*env)->ReleaseStringChars(env, jlangtag, langtag);
        ...
        }

        If getNumberPattern() call returns NULL, langtag is not released.

        Also, the call GetStringChars(env, jlangtag, JNI_FALSE) looks weird, as the last parameter should be a pointer to jboolean, not a jboolean. It works due to JNI_FALSE == 0 (or NULL).

        Attachments

          Issue Links

            Activity

              People

                zgu Zhengyu Gu
                zgu Zhengyu Gu
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: