+ //\r
+ // As the CoreInstallConfigurationTable() may be re-entered by CoreFreePool()\r
+ // in its calling stack, updating System table to the new table pointer must\r
+ // be done before calling CoreFreePool() to free the old table.\r
+ // It can make sure the gDxeCoreST->ConfigurationTable point to the new table\r
+ // and avoid the errors of use-after-free to the old table by the reenter of\r
+ // CoreInstallConfigurationTable() in CoreFreePool()'s calling stack.\r
+ //\r
+ gDxeCoreST->ConfigurationTable = EfiConfigurationTable;\r
+\r
+ //\r
+ // Free the old table after updating System Table to the new table pointer.\r
+ //\r
+ CoreFreePool (OldTable);\r
+ } else {\r
+ //\r
+ // Update System Table\r
+ //\r
+ gDxeCoreST->ConfigurationTable = EfiConfigurationTable;\r
+ }\r