summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Thomas McBride <mcbride@cvs.openbsd.org>2003-10-02 17:01:17 +0000
committerRyan Thomas McBride <mcbride@cvs.openbsd.org>2003-10-02 17:01:17 +0000
commit6da27ef08fdf14897d4f29c3efa5099e015e76c7 (patch)
treef9f109fc3dda5bdc8d0c68bc6198075088f59a08
parent67345882cdf8dbbc20c98c25ad6a491397daa5c6 (diff)
clean up p = realloc(p
ok deraadt@ henning@
-rw-r--r--sbin/pfctl/pfctl.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c
index 7559328f3a8..4728bee7f91 100644
--- a/sbin/pfctl/pfctl.c
+++ b/sbin/pfctl/pfctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl.c,v 1.189 2003/09/26 21:44:09 cedric Exp $ */
+/* $OpenBSD: pfctl.c,v 1.190 2003/10/02 17:01:16 mcbride Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -706,7 +706,7 @@ pfctl_show_states(int dev, u_int8_t proto, int opts)
{
struct pfioc_states ps;
struct pf_state *p;
- char *inbuf = NULL;
+ char *inbuf = NULL, *newinbuf = NULL;
unsigned len = 0;
int i;
@@ -714,9 +714,10 @@ pfctl_show_states(int dev, u_int8_t proto, int opts)
for (;;) {
ps.ps_len = len;
if (len) {
- ps.ps_buf = inbuf = realloc(inbuf, len);
- if (inbuf == NULL)
+ newinbuf = realloc(inbuf, len);
+ if (newinbuf == NULL)
err(1, "realloc");
+ ps.ps_buf = inbuf = newinbuf;
}
if (ioctl(dev, DIOCGETSTATES, &ps) < 0) {
warn("DIOCGETSTATES");