summaryrefslogtreecommitdiff
path: root/readfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'readfile.c')
-rw-r--r--readfile.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/readfile.c b/readfile.c
index 9729854..122020f 100644
--- a/readfile.c
+++ b/readfile.c
@@ -104,9 +104,11 @@ get_data_from_stdin (int *len_return)
count += n;
/* Here count <= allocated. Prepare for next round. */
if (count + BUFSIZ > allocated) {
+ char *oldp = cp;
allocated = 2 * allocated;
cp = realloc (cp, allocated + 1);
if (!cp) {
+ free(oldp);
fprintf(stderr, "cannot get memory for message file\n");
return NULL;
}