check __get_buf return status
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Fri, 5 Jun 1992 02:23:17 +0000 (18:23 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Fri, 5 Jun 1992 02:23:17 +0000 (18:23 -0800)
SCCS-vsn: lib/libc/db/hash/hash_page.c 5.20

usr/src/lib/libc/db/hash/hash_page.c

index 68c8051..0f0cc32 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)hash_page.c        5.19 (Berkeley) %G%";
+static char sccsid[] = "@(#)hash_page.c        5.20 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 /*
 #endif /* LIBC_SCCS and not lint */
 
 /*
@@ -162,7 +162,11 @@ __split_page(obucket, nbucket)
        copyto = (u_short)hashp->BSIZE;
        off = (u_short)hashp->BSIZE;
        old_bufp = __get_buf(obucket, NULL, 0);
        copyto = (u_short)hashp->BSIZE;
        off = (u_short)hashp->BSIZE;
        old_bufp = __get_buf(obucket, NULL, 0);
+       if (old_bufp == NULL)
+               return (-1);
        new_bufp = __get_buf(nbucket, NULL, 0);
        new_bufp = __get_buf(nbucket, NULL, 0);
+       if (new_bufp == NULL)
+               return (-1);
 
        old_bufp->flags |= (BUF_MOD | BUF_PIN);
        new_bufp->flags |= (BUF_MOD | BUF_PIN);
 
        old_bufp->flags |= (BUF_MOD | BUF_PIN);
        new_bufp->flags |= (BUF_MOD | BUF_PIN);