]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/netinet/in_pcb.c
xnu-201.tar.gz
[apple/xnu.git] / bsd / netinet / in_pcb.c
index ab4f2fc3dd816fce203e958781bb223461ed2c52..d12ef72b2bccf53a5b494b950597114677676c1e 100644 (file)
@@ -613,6 +613,8 @@ in_setsockaddr(so, nam)
         * Do the malloc first in case it blocks.
         */
        MALLOC(sin, struct sockaddr_in *, sizeof *sin, M_SONAME, M_WAITOK);
+       if (sin == NULL)
+               return ENOBUFS;
        bzero(sin, sizeof *sin);
        sin->sin_family = AF_INET;
        sin->sin_len = sizeof(*sin);
@@ -645,6 +647,8 @@ in_setpeeraddr(so, nam)
         * Do the malloc first in case it blocks.
         */
        MALLOC(sin, struct sockaddr_in *, sizeof *sin, M_SONAME, M_WAITOK);
+       if (sin == NULL)
+               return ENOBUFS;
        bzero((caddr_t)sin, sizeof (*sin));
        sin->sin_family = AF_INET;
        sin->sin_len = sizeof(*sin);
@@ -1004,7 +1008,7 @@ in_pcbinshash(inp)
         * If none exists, malloc one and tack it on.
         */
        if (phd == NULL) {
-               MALLOC(phd, struct inpcbport *, sizeof(struct inpcbport), M_PCB, M_NOWAIT);
+               MALLOC(phd, struct inpcbport *, sizeof(struct inpcbport), M_PCB, M_WAITOK);
                if (phd == NULL) {
                        return (ENOBUFS); /* XXX */
                }