summaryrefslogtreecommitdiff
path: root/usr.sbin/named/named-xfer/named-xfer.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-08-16 21:20:08 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-08-16 21:20:08 +0000
commit1c6ff3b71d87ee1764e62ffbbc57b3ec543ef219 (patch)
treec0c41d6e44c56c35fbda00c007957567235808f1 /usr.sbin/named/named-xfer/named-xfer.c
parent976c506be0a96c2303d0f33a3a62aabcf564690c (diff)
fix realloc memory leaks
Diffstat (limited to 'usr.sbin/named/named-xfer/named-xfer.c')
-rw-r--r--usr.sbin/named/named-xfer/named-xfer.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.sbin/named/named-xfer/named-xfer.c b/usr.sbin/named/named-xfer/named-xfer.c
index c8be29db6a9..ba4b5cdf887 100644
--- a/usr.sbin/named/named-xfer/named-xfer.c
+++ b/usr.sbin/named/named-xfer/named-xfer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: named-xfer.c,v 1.6 1998/05/22 07:09:23 millert Exp $ */
+/* $OpenBSD: named-xfer.c,v 1.7 1998/08/16 21:20:03 millert Exp $ */
/*
* The original version of xfer by Kevin Dunlap.
@@ -97,7 +97,7 @@ char copyright[] =
static char sccsid[] = "@(#)named-xfer.c 4.18 (Berkeley) 3/7/91";
static char rcsid[] = "$From: named-xfer.c,v 8.24 1998/04/07 04:59:45 vixie Exp $";
#else
-static char rcsid[] = "$OpenBSD: named-xfer.c,v 1.6 1998/05/22 07:09:23 millert Exp $";
+static char rcsid[] = "$OpenBSD: named-xfer.c,v 1.7 1998/08/16 21:20:03 millert Exp $";
#endif
#endif /* not lint */
@@ -665,7 +665,7 @@ getzone(zp, serial_no, port)
continue;
}
if (len > bufsize) {
- if ((buf = (u_char *)realloc(buf, len)) == NULL) {
+ if ((tmp = (u_char *)realloc(buf, len)) == NULL) {
syslog(LOG_INFO,
"malloc(%u) failed for SOA from server [%s], zone %s\n",
len,
@@ -674,6 +674,7 @@ getzone(zp, serial_no, port)
(void) my_close(s);
continue;
}
+ buf = tmp;
bufsize = len;
}
if (netread(s, (char *)buf, len, XFER_TIMER) < 0) {
@@ -906,8 +907,8 @@ getzone(zp, serial_no, port)
if ((len = _getshort(buf)) == 0)
break;
if (len > bufsize) {
- buf = (u_char *)realloc(buf, len);
- if (buf == NULL) {
+ tmp = (u_char *)realloc(buf, len);
+ if (tmp == NULL) {
syslog(LOG_INFO,
"malloc(%u) failed for packet from server [%s], zone %s\n",
len,
@@ -916,6 +917,7 @@ getzone(zp, serial_no, port)
error++;
break;
}
+ buf = tmp;
bufsize = len;
}
hp = (HEADER *)buf;