aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--driver.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/driver.c b/driver.c
index 39a20ab3..f6d34e2d 100644
--- a/driver.c
+++ b/driver.c
@@ -740,14 +740,16 @@ static int readheaders(int sock,
}
else
{
+ char *newhdrs;
int newlen;
newlen = oldlen + strlen(line);
- msgblk.headers = (char *) realloc(msgblk.headers, newlen + 1);
- if (msgblk.headers == NULL) {
+ newhdrs = (char *) realloc(msgblk.headers, newlen + 1);
+ if (newhdrs == NULL) {
free(line);
return(PS_IOERR);
}
+ msgblk.headers = newhdrs;
strcpy(msgblk.headers + oldlen, line);
free(line);
line = msgblk.headers + oldlen;