]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/IpSecDxe/Ikev2/Exchange.c
NetworkPkg: Avoid potential NULL pointer dereference
[mirror_edk2.git] / NetworkPkg / IpSecDxe / Ikev2 / Exchange.c
index 9d58ab0a46f6b46bb2f58fb3e257a19d042e07a5..1eddbfbcf10432efba87fb17fec87a68057d98d6 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The general interfaces of the IKEv2.\r
 \r
-  Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -495,6 +495,10 @@ Ikev2HandleSa (
             IsListEmpty (&IkeSaSession->ChildSaEstablishSessionList));\r
 \r
     ChildSaSession = Ikev2ChildSaSessionCreate (IkeSaSession, UdpService);\r
+    if (ChildSaSession == NULL) {\r
+      goto ON_ERROR;\r
+    }\r
+    \r
     ChildSaCommon  = &ChildSaSession->SessionCommon;\r
   }\r
 \r
@@ -519,6 +523,10 @@ Ikev2HandleSa (
             IsListEmpty (&IkeSaSession->ChildSaEstablishSessionList));\r
 \r
     ChildSaSession = Ikev2ChildSaSessionCreate (IkeSaSession, UdpService);\r
+    if (ChildSaSession == NULL) {\r
+      goto ON_ERROR;\r
+    }\r
+    \r
     ChildSaCommon  = &ChildSaSession->SessionCommon;\r
 \r
     //\r