Don't leak upon failed realloc.
libjava 2008-03-10 Jim Meyering <meyering@redhat.com> Don't leak upon failed realloc. * gnu/classpath/natSystemProperties.cc (SystemProperties::insertSystemProperties): libjava/classpath 2008-03-10 Jim Meyering <meyering@redhat.com> Don't leak upon failed realloc. * native/jni/classpath/jcl.c (JCL_realloc): Upon failed realloc, free the original buffer before throwing the exception. From-SVN: r133094
This commit is contained in:
@@ -270,7 +270,10 @@ gnu::classpath::SystemProperties::insertSystemProperties (::java::util::Properti
|
||||
if (errno != ERANGE)
|
||||
break;
|
||||
buflen = 2 * buflen;
|
||||
char *orig_buf = buffer;
|
||||
buffer = (char *) realloc (buffer, buflen);
|
||||
if (buffer == NULL)
|
||||
free (orig_buf);
|
||||
}
|
||||
if (buffer != NULL)
|
||||
free (buffer);
|
||||
|
||||
Reference in New Issue
Block a user