diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2001-05-15 15:31:10 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2001-05-15 15:31:10 +0000 |
commit | 823a5421f0e30fea5d78c35d8cc26cb7f4f9eb2e (patch) | |
tree | a49cdd3f41c2a08f37c91446d6292a348da8cc85 /usr.bin | |
parent | 917189dc8402b639be51f798db3b118b7abc081c (diff) |
Add missing memset() from one of the select() fixes. Also free existing
readfds if malloc/realloc fails.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/sup/src/scmio.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/sup/src/scmio.c b/usr.bin/sup/src/scmio.c index 9524748de75..6c1ae8afe69 100644 --- a/usr.bin/sup/src/scmio.c +++ b/usr.bin/sup/src/scmio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scmio.c,v 1.9 2001/05/07 13:09:39 millert Exp $ */ +/* $OpenBSD: scmio.c,v 1.10 2001/05/15 15:31:09 millert Exp $ */ /* * Copyright (c) 1992 Carnegie Mellon University @@ -477,10 +477,14 @@ readdata(count, data) /* read raw data from network */ if (rfdsize < howmany(netfile+1, NFDBITS) * sizeof(fd_mask)) { rfdsize = howmany(netfile+1, NFDBITS) * sizeof(fd_mask); p = readfds ? realloc(readfds, rfdsize) : malloc(rfdsize); - if (p == NULL) + if (p == NULL) { + free(readfds); + rfdsize = 0; return (SCMERR); + } readfds = (fd_set *) p; } + memset(readfds, 0, rfdsize); bufptr = buffer; bufcnt = 0; timout.tv_usec = 0; |