Fix memory leak

Change-Id: I0e5c3af0504f3090a5db7692c6bfb1d33b3aa81f
This commit is contained in:
Stephan Bergmann 2014-05-30 15:46:14 +02:00
parent 4bd5d16381
commit 63405c0500
2 changed files with 8 additions and 15 deletions

View file

@ -122,10 +122,9 @@ namespace connectivity
fullProfilePath = profilePath;
}
ProfileStruct* profileItem = new ProfileStruct(product,profileName,
m_Product.mProfileList[profileName] = ProfileStruct(product,profileName,
fullProfilePath
);
m_Product.mProfileList[profileName] = profileItem;
sal_Int32 isDefault = 0;
if (!sIsDefault.isEmpty())
@ -151,7 +150,7 @@ namespace connectivity
return OUString();
}
else
return m_Product.mProfileList[profileName]->getProfilePath();
return m_Product.mProfileList[profileName].getProfilePath();
}
OUString ProfileAccess::getDefaultProfile( ::com::sun::star::mozilla::MozillaProductType product ) throw (::com::sun::star::uno::RuntimeException)
@ -168,8 +167,7 @@ namespace connectivity
//there are not any profiles
return OUString();
}
ProfileStruct * aProfile = (*m_Product.mProfileList.begin()).second;
return aProfile->getProfileName();
return (*m_Product.mProfileList.begin()).second.getProfileName();
}
}
}

View file

@ -34,14 +34,7 @@
#include "dllapi.h"
using namespace com::sun::star::mozilla;
namespace connectivity
{
namespace mork
{
class ProfileStruct;
}
}
typedef ::std::map < OUString, ::connectivity::mork::ProfileStruct* > ProfileList;
namespace connectivity
{
namespace mork
@ -49,8 +42,8 @@ namespace connectivity
class ProfileStruct
{
public:
ProfileStruct(MozillaProductType aProduct, const OUString& aProfileName,
const OUString &aProfilePath
ProfileStruct(MozillaProductType aProduct = MozillaProductType_Default, const OUString& aProfileName = OUString(),
const OUString &aProfilePath = OUString()
);
MozillaProductType getProductType() { return product;}
OUString getProfileName(){ return profileName;}
@ -61,6 +54,8 @@ namespace connectivity
OUString profilePath;
};
typedef ::std::map < OUString, ProfileStruct > ProfileList;
class ProductStruct
{
public: