diff options
author | 1998-08-14 21:39:18 +0000 | |
---|---|---|
committer | 1998-08-14 21:39:18 +0000 | |
commit | e512315e955209fedb2d53461c3973f04fc1dd55 (patch) | |
tree | b9010203c21d01e17b517ff226492586563669b8 /lib/libc/db/btree/bt_overflow.c | |
parent | realloc repair (diff) | |
download | wireguard-openbsd-e512315e955209fedb2d53461c3973f04fc1dd55.tar.xz wireguard-openbsd-e512315e955209fedb2d53461c3973f04fc1dd55.zip |
realloc repair
Diffstat (limited to 'lib/libc/db/btree/bt_overflow.c')
-rw-r--r-- | lib/libc/db/btree/bt_overflow.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libc/db/btree/bt_overflow.c b/lib/libc/db/btree/bt_overflow.c index f87d01ad5c2..23876f1d6fe 100644 --- a/lib/libc/db/btree/bt_overflow.c +++ b/lib/libc/db/btree/bt_overflow.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: bt_overflow.c,v 1.3 1996/08/19 08:20:09 tholo Exp $"; +static char rcsid[] = "$OpenBSD: bt_overflow.c,v 1.4 1998/08/14 21:39:18 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -88,6 +88,7 @@ __ovfl_get(t, p, ssz, buf, bufsz) pgno_t pg; size_t nb, plen; u_int32_t sz; + void *tp; memmove(&pg, p, sizeof(pgno_t)); memmove(&sz, (char *)p + sizeof(pgno_t), sizeof(u_int32_t)); @@ -99,9 +100,10 @@ __ovfl_get(t, p, ssz, buf, bufsz) #endif /* Make the buffer bigger as necessary. */ if (*bufsz < sz) { - *buf = (char *)(*buf == NULL ? malloc(sz) : realloc(*buf, sz)); - if (*buf == NULL) + tp = (char *)(*buf == NULL ? malloc(sz) : realloc(*buf, sz)); + if (tp == NULL) return (RET_ERROR); + *buf = tp; *bufsz = sz; } |