From: Nikodemus Siivola Date: Fri, 18 Nov 2011 14:33:35 +0000 (+0200) Subject: sb-bsd-sockets: check for MAKE-ALIEN success in GET-PROTOCOL-BY-NAME X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=ab5427d31da2bd95805cccc8e47b8f43d3dd606d;p=sbcl.git sb-bsd-sockets: check for MAKE-ALIEN success in GET-PROTOCOL-BY-NAME Currently of malloc fails it returns a null alien. Yuck. --- diff --git a/contrib/sb-bsd-sockets/inet.lisp b/contrib/sb-bsd-sockets/inet.lisp index e4f7ff2..ebe6e35 100644 --- a/contrib/sb-bsd-sockets/inet.lisp +++ b/contrib/sb-bsd-sockets/inet.lisp @@ -106,6 +106,10 @@ a list of protocol aliases" buffer (sb-alien:make-alien sb-alien:char buffer-length)) #-solaris (setf result (sb-alien:make-alien (* sockint::protoent))) + (when (or (sb-alien:null-alien result-buf) + (sb-alien:null-alien buffer) + (sb-alien:null-alien result)) + (error "Could not allocate foreign memory.")) (let ((res (sockint::getprotobyname-r name result-buf buffer buffer-length #-solaris result))) (cond ((eql res 0)