lowlevellibsandfws/apputils/src/Baksrv.cpp
changeset 44 97b0fb8a2cc2
parent 0 e4d67989cc36
child 57 2efc27d87e1c
--- a/lowlevellibsandfws/apputils/src/Baksrv.cpp	Mon May 03 14:06:43 2010 +0300
+++ b/lowlevellibsandfws/apputils/src/Baksrv.cpp	Tue Jul 20 16:35:53 2010 +0530
@@ -1027,16 +1027,19 @@
 	
 	TCompletionType completionType = ECompleteSync;
 	
-	iClientMessage = BSUL::CClientMessage::NewL(aMessage);
+	BSUL::CClientMessage* clientMessage = 0;
+	clientMessage = BSUL::CClientMessage::NewL(aMessage);
 	
 	//Push iClientMessage onto the cleanupstack. Although an instance variable, 
 	//the lifetime of the object is contained to this function so it needs to
 	//be pushed and popped here as it is not deleted in the destructor
-	CleanupStack::PushL(iClientMessage);
+	CleanupStack::PushL(clientMessage);
 	
 	//Validate the message
-	TRAPD(error, iClientMessage->ValidateL());
-		
+	TRAPD(error, clientMessage->ValidateL());
+	
+	iClientMessage = clientMessage;
+	
 	if(error == KErrNone)	
 		{
 		TRAP(error, DoServiceL(completionType));
@@ -1055,7 +1058,8 @@
 		}
 	
 	//Pop and destroy message
-	CleanupStack::PopAndDestroy(iClientMessage);
+	CleanupStack::PopAndDestroy(clientMessage);
+	clientMessage = NULL;
 	iClientMessage = NULL;
 	}