summaryrefslogtreecommitdiff
path: root/connectivity/source/drivers/mozab/bootstrap
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-03-08 15:56:52 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-03-08 15:56:52 +0000
commit14881451de9dfba0ca783c695e0c538ae72e6736 (patch)
treecdd43ff28ca45112ab8328f20e04d66ebda5bbf5 /connectivity/source/drivers/mozab/bootstrap
parent002f0815b2fe82ca6b523fab1a781a75fb563cd9 (diff)
valgrind: fix leak
Change-Id: I8510a59a3d4409bf7203495114e239b4c7effcd8
Diffstat (limited to 'connectivity/source/drivers/mozab/bootstrap')
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx36
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx10
2 files changed, 25 insertions, 21 deletions
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx
index 1adb8993fde0..b2ef4d9ffade 100644
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx
+++ b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx
@@ -26,15 +26,21 @@ namespace connectivity
{
namespace mozab
{
- ProfileStruct::ProfileStruct(MozillaProductType aProduct, const OUString& aProfileName,
- const OUString& aProfilePath
- )
+ ProfileStruct::ProfileStruct()
+ : product(css::mozilla::MozillaProductType_Default)
{
- product=aProduct;
- profileName = aProfileName;
- profilePath = aProfilePath;
}
- const OUString& ProfileStruct::getProfilePath()
+
+ ProfileStruct::ProfileStruct(MozillaProductType aProduct,
+ const OUString& aProfileName,
+ const OUString& aProfilePath)
+ : product(aProduct)
+ , profileName(aProfileName)
+ , profilePath(aProfilePath)
+ {
+ }
+
+ const OUString& ProfileStruct::getProfilePath() const
{
return profilePath;
}
@@ -42,6 +48,7 @@ namespace connectivity
ProfileAccess::~ProfileAccess()
{
}
+
ProfileAccess::ProfileAccess()
{
LoadProductsInfo();
@@ -121,10 +128,7 @@ namespace connectivity
fullProfilePath = profilePath;
}
- ProfileStruct* profileItem = new ProfileStruct(product,profileName,
- fullProfilePath
- );
- rProduct.mProfileList[profileName] = profileItem;
+ rProduct.mProfileList[profileName] = ProfileStruct(product,profileName,fullProfilePath);
sal_Int32 isDefault = 0;
if (!sIsDefault.isEmpty())
@@ -149,7 +153,7 @@ namespace connectivity
return OUString();
}
else
- return rProduct.mProfileList[profileName]->getProfilePath();
+ return rProduct.mProfileList[profileName].getProfilePath();
}
::sal_Int32 ProfileAccess::getProfileCount( css::mozilla::MozillaProductType product)
@@ -168,8 +172,8 @@ namespace connectivity
itor != rProduct.mProfileList.end();
++itor)
{
- ProfileStruct * aProfile = (*itor).second;
- list[i] = aProfile->getProfileName();
+ const ProfileStruct& rProfile = (*itor).second;
+ list[i] = rProfile.getProfileName();
i++;
}
@@ -190,8 +194,8 @@ namespace connectivity
//there are not any profiles
return OUString();
}
- ProfileStruct * aProfile = (*rProduct.mProfileList.begin()).second;
- return aProfile->getProfileName();
+ const ProfileStruct& rProfile = (*rProduct.mProfileList.begin()).second;
+ return rProfile.getProfileName();
}
bool ProfileAccess::isProfileLocked( css::mozilla::MozillaProductType product, const OUString& profileName )
{
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx
index 6cb9efe8edf4..395724ff0790 100644
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx
+++ b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx
@@ -39,7 +39,7 @@ namespace connectivity
class ProfileStruct;
}
}
-typedef std::map < OUString, ::connectivity::mozab::ProfileStruct* > ProfileList;
+typedef std::map<OUString, ::connectivity::mozab::ProfileStruct> ProfileList;
namespace connectivity
{
namespace mozab
@@ -47,10 +47,10 @@ namespace connectivity
class ProfileStruct
{
public:
- ProfileStruct(MozillaProductType aProduct, const OUString& aProfileName,
- const OUString &aProfilePath);
- const OUString& getProfileName(){ return profileName;}
- const OUString& getProfilePath();
+ ProfileStruct();
+ ProfileStruct(MozillaProductType aProduct, const OUString& aProfileName, const OUString &aProfilePath);
+ const OUString& getProfileName() const { return profileName;}
+ const OUString& getProfilePath() const;
private:
MozillaProductType product;
OUString profileName;