* [PCH] fix memory-allocation bug in cpp_read_state
@ 2002-11-15 10:21 Geoffrey Keating
0 siblings, 0 replies; only message in thread
From: Geoffrey Keating @ 2002-11-15 10:21 UTC (permalink / raw)
To: gcc-patches
Obvious bug.
Tested by running pch.exp on powerpc-darwin.
--
- Geoffrey Keating <geoffk@apple.com>
===File ~/patches/pchbranch-cppreadstatedefn.patch==========
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ChangeLog,v
retrieving revision 1.12690.2.81
diff -u -p -u -p -r1.12690.2.81 ChangeLog
--- ChangeLog 15 Nov 2002 16:44:16 -0000 1.12690.2.81
+++ ChangeLog 15 Nov 2002 18:20:32 -0000
@@ -1,3 +1,7 @@
+2002-11-15 Geoffrey Keating <geoffk@apple.com>
+
+ * cpppch.c (cpp_read_state): Correct size reallocated for 'defn'.
+
2002-11-14 Geoffrey Keating <geoffk@apple.com>
* optabs.h (code_to_optab): Add GTY marker.
Index: cpppch.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/cpppch.c,v
retrieving revision 1.1.4.3
diff -u -p -u -p -r1.1.4.3 cpppch.c
--- cpppch.c 9 Nov 2002 01:12:21 -0000 1.1.4.3
+++ cpppch.c 15 Nov 2002 18:20:32 -0000
@@ -609,9 +609,8 @@ cpp_read_state (r, name, f, data)
if (defnlen < m.definition_length + 1)
{
- free (defn);
defnlen = m.definition_length + 256;
- defn = xmalloc (m.definition_length);
+ defn = xrealloc (defn, defnlen);
}
if (fread (defn, 1, m.definition_length, f) != m.definition_length)
============================================================
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-11-15 18:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-15 10:21 [PCH] fix memory-allocation bug in cpp_read_state Geoffrey Keating
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).