summaryrefslogtreecommitdiffstats
path: root/libjava/gnu/classpath/natSystemProperties.cc
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2008-03-10 22:08:34 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2008-03-10 22:08:34 +0000
commit30d3e09e6511630fed6f005202bb6e252f333a9b (patch)
tree760625d856048373d82ecd71dfe46ad4f26ff853 /libjava/gnu/classpath/natSystemProperties.cc
parent267858a744be0cea0452bc2acbd3b1e95c57dfcf (diff)
downloadppe42-gcc-30d3e09e6511630fed6f005202bb6e252f333a9b.tar.gz
ppe42-gcc-30d3e09e6511630fed6f005202bb6e252f333a9b.zip
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@133094 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/gnu/classpath/natSystemProperties.cc')
-rw-r--r--libjava/gnu/classpath/natSystemProperties.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/libjava/gnu/classpath/natSystemProperties.cc b/libjava/gnu/classpath/natSystemProperties.cc
index 089a14e5b4e..e259304b165 100644
--- a/libjava/gnu/classpath/natSystemProperties.cc
+++ b/libjava/gnu/classpath/natSystemProperties.cc
@@ -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);
OpenPOWER on IntegriCloud