Revision: 13938
          http://edk2.svn.sourceforge.net/edk2/?rev=13938&view=rev
Author:   jcarsey
Date:     2012-11-13 16:08:52 +0000 (Tue, 13 Nov 2012)
Log Message:
-----------
ShellPkg: Correct 3 places where memory was not being properly released by the 
shell.  

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <[email protected]>
Reviewed-by: Erik Bjorge <[email protected]>
Reviewed-by: Liu, Jiang A <[email protected]>

Modified Paths:
--------------
    trunk/edk2/ShellPkg/Application/Shell/ShellEnvVar.c
    trunk/edk2/ShellPkg/Application/Shell/ShellParametersProtocol.c
    trunk/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c

Modified: trunk/edk2/ShellPkg/Application/Shell/ShellEnvVar.c
===================================================================
--- trunk/edk2/ShellPkg/Application/Shell/ShellEnvVar.c 2012-11-12 06:18:02 UTC 
(rev 13937)
+++ trunk/edk2/ShellPkg/Application/Shell/ShellEnvVar.c 2012-11-13 16:08:52 UTC 
(rev 13938)
@@ -105,7 +105,7 @@
   }
 
   for ( Node = (ENV_VAR_LIST*)GetFirstNode(List)
-      ; IsListEmpty(List)
+      ; !IsListEmpty(List)
       ; Node = (ENV_VAR_LIST*)GetFirstNode(List)
      ){
     ASSERT(Node != NULL);

Modified: trunk/edk2/ShellPkg/Application/Shell/ShellParametersProtocol.c
===================================================================
--- trunk/edk2/ShellPkg/Application/Shell/ShellParametersProtocol.c     
2012-11-12 06:18:02 UTC (rev 13937)
+++ trunk/edk2/ShellPkg/Application/Shell/ShellParametersProtocol.c     
2012-11-13 16:08:52 UTC (rev 13938)
@@ -192,6 +192,7 @@
   //
   (*Argv) = AllocateZeroPool((Count)*sizeof(CHAR16*));
   if (*Argv == NULL) {
+    SHELL_FREE_NON_NULL(TempParameter);
     return (EFI_OUT_OF_RESOURCES);
   }
 
@@ -207,6 +208,7 @@
     (*Argc)++;
   }
   ASSERT(Count >= (*Argc));
+  SHELL_FREE_NON_NULL(TempParameter);
   return (EFI_SUCCESS);
 }
 

Modified: trunk/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
===================================================================
--- trunk/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c       
2012-11-12 06:18:02 UTC (rev 13937)
+++ trunk/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c       
2012-11-13 16:08:52 UTC (rev 13938)
@@ -129,7 +129,7 @@
   )
 {
   SHELL_COMMAND_INTERNAL_LIST_ENTRY *Node;
-  COMMAND_LIST                      *Node2;
+  ALIAS_LIST                        *Node2;
   SCRIPT_FILE_LIST                  *Node3;
   SHELL_MAP_LIST                    *MapNode;
   //
@@ -144,13 +144,14 @@
   }
 
   //
-  // enumerate through the init command list and free all memory
+  // enumerate through the alias list and free all memory
   //
   while (!IsListEmpty (&mAliasList.Link)) {
-    Node2 = (COMMAND_LIST *)GetFirstNode(&mAliasList.Link);
+    Node2 = (ALIAS_LIST *)GetFirstNode(&mAliasList.Link);
     RemoveEntryList(&Node2->Link);
     SHELL_FREE_NON_NULL(Node2->CommandString);
-    FreePool(Node2);
+    SHELL_FREE_NON_NULL(Node2->Alias);
+    SHELL_FREE_NON_NULL(Node2);
     DEBUG_CODE(Node2 = NULL;);
   }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to