repeat after me: realloc, THEN assign pointer...

This commit is contained in:
cgd 1994-02-24 09:03:39 +00:00
parent e50e5bc84b
commit a2f41483b7
1 changed files with 3 additions and 4 deletions

View File

@ -33,7 +33,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/* from: static char sccsid[] = "@(#)rec_get.c 8.2 (Berkeley) 9/7/93"; */
static char *rcsid = "$Id: rec_get.c,v 1.4 1993/09/09 02:42:23 cgd Exp $";
static char *rcsid = "$Id: rec_get.c,v 1.5 1994/02/24 09:03:39 cgd Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@ -130,14 +130,13 @@ __rec_fpipe(t, top)
int ch;
char *p;
data.data = t->bt_dbuf;
data.size = t->bt_reclen;
if (t->bt_dbufsz < t->bt_reclen) {
if ((t->bt_dbuf = realloc(t->bt_dbuf, t->bt_reclen)) == NULL)
return (RET_ERROR);
t->bt_dbufsz = t->bt_reclen;
}
data.data = t->bt_dbuf;
data.size = t->bt_reclen;
for (nrec = t->bt_nrecs; nrec < top; ++nrec) {
len = t->bt_reclen;
for (p = t->bt_dbuf;; *p++ = ch)