Xref: utzoo comp.bugs.sys5:772 comp.unix.wizards:14809 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!hplabs!hp-sdd!ncr-sd!ncrcae!sauron!wescott From: wescott@sauron.Columbia.NCR.COM (Mike Wescott) Newsgroups: comp.bugs.sys5,comp.unix.wizards Subject: bug in setvbuf Message-ID: <1575@sauron.Columbia.NCR.COM> Date: 22 Feb 89 03:33:58 GMT Reply-To: wescott@sauron.Columbia.NCR.COM (Mike Wescott) Organization: Tower Uniprocessor Systems, E&M-Columbia, NCR, W Columbia, SC Lines: 12 In the SysVr3v2 code, setvbuf(fp,buf,type,size) when called with buf==NULL will malloc() a buffer of size, free()ing the old one if _IOMYBUF is set in fp->_flags. As used elsewhere in the stdio code _IOMYBUF is used to indicate that the buffer has been malloc()ed in the stdio code and should be free()ed at fclose() or when setvbuf(), or setbuf() overrides. _IOMYBUF is NOT set in setvbuf when the buffer is malloc()ed. Shouldn't it be? If not, how would the space get freed? No, I don't think the programmer should do a free(fp->_base). -- -Mike Wescott mike.wescott@ncrcae.Columbia.NCR.COM