QcomModulePkg: Validate NodeName pointer before passing it to function

Validate NodeName pointer before passing it to function.

Change-Id: I4385f053d631990061e19ecac3b4cd673310fccc
Signed-off-by: Komal Bajaj <kbajaj@codeaurora.org>
diff --git a/QcomModulePkg/Library/BootLib/FdtRw.c b/QcomModulePkg/Library/BootLib/FdtRw.c
index d9abea1..c5bed06 100644
--- a/QcomModulePkg/Library/BootLib/FdtRw.c
+++ b/QcomModulePkg/Library/BootLib/FdtRw.c
@@ -118,9 +118,13 @@
     Node->Next = NodeList;
     NodeList = Node;
     Node->NodeName = AllocateZeroPool (NameLen + 1);
-    CopyMem ((VOID *)Node->NodeName, NodeName, NameLen);
+    if (Node->NodeName) {
+      CopyMem ((VOID *)Node->NodeName, NodeName, NameLen);
 
-    Node->NodeOffset = NodeOffset;
+      Node->NodeOffset = NodeOffset;
+    } else {
+        FdtDeleteNodeList ();
+    }
   } else {
     FdtDeleteNodeList ();
   }