bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/56713] New: memory leak in classpath/native/jni/java-nio/


From: bernd.edlinger at hotmail dot de
Subject: [Bug classpath/56713] New: memory leak in classpath/native/jni/java-nio/java_nio_MappedByteBufferImpl.c
Date: Sun, 24 Mar 2013 16:18:46 +0000


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56713



             Bug #: 56713

           Summary: memory leak in

                    classpath/native/jni/java-nio/java_nio_MappedByteBuffe

                    rImpl.c

    Classification: Unclassified

           Product: classpath

           Version: unspecified

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: classpath

        AssignedTo: address@hidden

        ReportedBy: address@hidden





in this source file that came with GCC-4.6.3

there is a function Java_java_nio_MappedByteBufferImpl_isLoadedImpl

there is a memory allocated in line 172:

vec = (char *) malloc (count * sizeof (unsigned char));



but the memory is not free'd in all code paths.

proposed change in lines 191-196:



  for (i = 0; i < count; i++)

    {

      if ((vec[i] & 1) == 0)

        return JNI_FALSE;

    }

  return JNI_TRUE;



=>



  for (i = 0; i < count; i++)

    {

      if ((vec[i] & 1) == 0)

      {

        free (vec);

        return JNI_FALSE;

      }

    }

  free (vec);

  return JNI_TRUE;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]