eapol/eapol_framework/eapol_symbian/am/type/aka/symbian/eap_am_type_aka_symbian.cpp
changeset 52 c23bdf5a328a
parent 39 fe6b6762fccd
--- a/eapol/eapol_framework/eapol_symbian/am/type/aka/symbian/eap_am_type_aka_symbian.cpp	Fri Sep 17 08:30:11 2010 +0300
+++ b/eapol/eapol_framework/eapol_symbian/am/type/aka/symbian/eap_am_type_aka_symbian.cpp	Mon Oct 04 00:19:54 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 46.1.10 %
+* %version: 46.1.11 %
 */
 
 // This is enumeration of EAPOL source code.
@@ -228,7 +228,7 @@
 	const bool aIsClient,
 	const eap_am_network_id_c * const receive_network_id)
 {
-	eap_am_type_aka_symbian_c* self = new(ELeave) eap_am_type_aka_symbian_c(
+	eap_am_type_aka_symbian_c* self = new eap_am_type_aka_symbian_c(
 		aTools, 
 		aPartner, 
 		aIndexType, 
@@ -237,16 +237,29 @@
 		aIsClient,
 		receive_network_id);
 		
-	CleanupStack::PushL(self);
-	
-	self->ConstructL();
-
-	if (self->get_is_valid() != true)
+	if (self == 0
+		|| self->get_is_valid() != true)
 	{
+		if (self != 0)
+		{
+			self->shutdown();
+		}
+
+		delete self;
+
 		User::Leave(KErrGeneral);
 	}
-	
-	CleanupStack::Pop();
+
+	TRAPD(error, self->ConstructL());
+
+	if (error != KErrNone)
+	{
+		self->shutdown();
+		delete self;
+
+		User::Leave(error);
+	}
+
 	return self;
 }