From ab5427d31da2bd95805cccc8e47b8f43d3dd606d Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Fri, 18 Nov 2011 16:33:35 +0200 Subject: [PATCH] sb-bsd-sockets: check for MAKE-ALIEN success in GET-PROTOCOL-BY-NAME Currently of malloc fails it returns a null alien. Yuck. --- contrib/sb-bsd-sockets/inet.lisp | 4 ++++ 1 file changed, 4 insertions(+) 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) -- 1.7.10.4