diff options
author | Jim Meyering <meyering@redhat.com> | 2008-03-10 22:08:34 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2008-03-10 22:08:34 +0000 |
commit | ea1b8c8764d150970c1203585d4cf8bf684afbf6 (patch) | |
tree | 760625d856048373d82ecd71dfe46ad4f26ff853 /libjava/gnu | |
parent | dd6d52363003ef0a2e7c2293bb6d0c5f1f829b6a (diff) | |
download | gcc-ea1b8c8764d150970c1203585d4cf8bf684afbf6.zip gcc-ea1b8c8764d150970c1203585d4cf8bf684afbf6.tar.gz gcc-ea1b8c8764d150970c1203585d4cf8bf684afbf6.tar.bz2 |
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
Diffstat (limited to 'libjava/gnu')
-rw-r--r-- | libjava/gnu/classpath/natSystemProperties.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libjava/gnu/classpath/natSystemProperties.cc b/libjava/gnu/classpath/natSystemProperties.cc index 089a14e..e259304 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); |