aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-10-07 07:57:31 +0000
committerRichard Stallman <rms@gnu.org>1992-10-07 07:57:31 +0000
commit173c6344dfc0870f9e7f2c5326159d3de3dd7265 (patch)
tree0c70ae36b4c9da33083eef3ad9c2d19ae3ac7e4c
parentc9d929d737bddd47bd8b16ab5b87776d4c8ef5f3 (diff)
downloadgcc-173c6344dfc0870f9e7f2c5326159d3de3dd7265.zip
gcc-173c6344dfc0870f9e7f2c5326159d3de3dd7265.tar.gz
gcc-173c6344dfc0870f9e7f2c5326159d3de3dd7265.tar.bz2
(finclude): Set fp->buf earlier, so it's freed on error.
From-SVN: r2348
-rw-r--r--gcc/cccp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/cccp.c b/gcc/cccp.c
index 5e055be..adaec46 100644
--- a/gcc/cccp.c
+++ b/gcc/cccp.c
@@ -4087,6 +4087,7 @@ finclude (f, fname, op, system_header_p, dirptr)
st_size = 0;
basep = (U_CHAR *) xmalloc (bsize + 2);
+ fp->buf = basep; /* So it will get freed, on error. */
bufp = basep;
for (;;) {
@@ -4100,10 +4101,10 @@ finclude (f, fname, op, system_header_p, dirptr)
if (bsize == st_size) { /* Buffer is full! */
bsize *= 2;
basep = (U_CHAR *) xrealloc (basep, bsize + 2);
+ fp->buf = basep;
bufp = basep + st_size; /* May have moved */
}
}
- fp->buf = basep;
fp->bufp = fp->buf;
fp->length = st_size;
}