]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/BsdSocketLib/close.c
Fixed close for socket to properly release the socket context structure and the handle.
[mirror_edk2.git] / StdLib / BsdSocketLib / close.c
index f3f7e98cbace304c08678cfa70293799f5eb2df2..01eb48ecb58991a0f298eeaff86184532489ff27 100644 (file)
@@ -31,7 +31,6 @@ BslSocketCloseWork (
   IN int * pErrno\r
   )\r
 {\r
-  EFI_SERVICE_BINDING_PROTOCOL * pServiceBinding;\r
   EFI_STATUS Status;\r
 \r
   //\r
@@ -50,21 +49,9 @@ BslSocketCloseWork (
   }\r
   if ( !EFI_ERROR ( Status )) {\r
     //\r
-    //  Locate the socket protocol\r
+    //  Release the socket resources\r
     //\r
-    Status = gBS->LocateProtocol ( &gEfiSocketServiceBindingProtocolGuid,\r
-                                   NULL,\r
-                                   (VOID **) &pServiceBinding );\r
-    if ( !EFI_ERROR ( Status )) {\r
-      //\r
-      //  Release the handle\r
-      //\r
-      Status = pServiceBinding->DestroyChild ( pServiceBinding,\r
-                                               pSocketProtocol->SocketHandle );\r
-    }\r
-    if ( EFI_ERROR ( Status )) {\r
-      *pErrno = EIO;\r
-    }\r
+    *pErrno = EslServiceFreeProtocol ( pSocketProtocol );\r
   }\r
   else {\r
     DEBUG (( DEBUG_ERROR,\r