javaextensions/wma/sms_cbs/pushplugin/cbs/src.s60/cbsserverconnection.cpp
branchRCL_3
changeset 17 0fd27995241b
parent 14 04becd199f91
child 24 6c158198356e
--- a/javaextensions/wma/sms_cbs/pushplugin/cbs/src.s60/cbsserverconnection.cpp	Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/wma/sms_cbs/pushplugin/cbs/src.s60/cbsserverconnection.cpp	Tue May 11 16:07:20 2010 +0300
@@ -287,11 +287,12 @@
     JELOG2(EWMA);
     TCBSParametersBuf cbsParametersBuf;
     std::wstring path;
+    char* messagePath =0;
     path += mMessageStoreDirName;
     try
     {
         path += JavaCommonUtils::intToWstring(mFirstMessageInStore);
-        char* messagePath = JavaCommonUtils::wstringToUtf8(path);
+        messagePath = JavaCommonUtils::wstringToUtf8(path);
         // Read the CBS file contents
         readStream.exceptions(std::ifstream::failbit|std::ifstream::badbit);
 
@@ -313,12 +314,14 @@
     catch (std::ifstream::failure e)
     {
         ELOG(EWMA,"CBS : Exception while opening/reading file");
+        delete[] messagePath;
         readStream.exceptions(std::ofstream::goodbit);
         readStream.close();
         return KErrGeneral;
     }
     catch (ExceptionBase ex)
     {
+        delete[] messagePath;
         return KErrGeneral;
     }
     return KErrNone;
@@ -689,6 +692,7 @@
     catch (std::ofstream::failure e)
     {
         ELOG(EWMA,"CBS : Exception while creating/writing file");
+        delete[] messagePath;
         writeStream.exceptions(std::ofstream::goodbit);
         writeStream.close();
         User::Leave(KErrGeneral);