]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Fix potential memory access violation
authorydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 13 Jan 2011 02:25:24 +0000 (02:25 +0000)
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 13 Jan 2011 02:25:24 +0000 (02:25 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11248 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c

index 110e4890c88f9c244c7febe002a76e33cfbd0dce..2a65422e1c5875b1d7946395766be818b7df73fe 100644 (file)
@@ -913,8 +913,9 @@ TcpIoReceive (
 \r
   FragmentCount = Packet->BlockOpNum;
   Fragment      = AllocatePool (FragmentCount * sizeof (NET_FRAGMENT));
-  if (Fragment == NULL) {
-    return EFI_OUT_OF_RESOURCES;
+  if (Fragment == NULL) {\r
+    Status = EFI_OUT_OF_RESOURCES;\r
+    goto ON_EXIT;\r
   }
   //
   // Build the fragment table.
@@ -988,8 +989,10 @@ ON_EXIT:
   } else {\r
     TcpIo->RxToken.Tcp6Token.Packet.RxData = NULL;\r
   }\r
-\r
-  FreePool (Fragment);\r
+  \r
+  if (Fragment != NULL) {\r
+    FreePool (Fragment);\r
+  }\r
 
   return Status;\r
 }\r