Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions examples/cpp/MacProxy/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ std::string GetProxyForURL(const std::string& url)
urlProxArrayRef = CFNetworkCopyProxiesForURL(urlRef, proxyDicRef);
if (!urlProxArrayRef)
goto cleanup;
if (CFArrayGetCount(urlProxArrayRef) == 0)
goto cleanup;

defProxyDic = (CFDictionaryRef)CFArrayGetValueAtIndex(urlProxArrayRef, 0);
if (!defProxyDic)
Expand All @@ -82,11 +84,6 @@ std::string GetProxyForURL(const std::string& url)

cleanup:

if (hostNameRef)
{
CFRelease(hostNameRef);
hostNameRef = NULL;
}
if (urlProxArrayRef)
{
CFRelease(urlProxArrayRef);
Expand Down
8 changes: 4 additions & 4 deletions lib/api/LogManagerFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <cassert>
#include <functional>
#include <iostream>
#include <memory>
#include <utility>

#include <ctime>
Expand All @@ -33,9 +34,9 @@ namespace MAT_NS_BEGIN
ILogManager* LogManagerFactory::Create(ILogConfiguration& configuration)
{
LOCKGUARD(ILogManagerInternal::managers_lock);
auto logManager = new LogManagerImpl(configuration);
ILogManagerInternal::managers.emplace(logManager);
return logManager;
auto logManager = std::make_unique<LogManagerImpl>(configuration);
ILogManagerInternal::managers.emplace(logManager.get());
return logManager.release();
}

/// <summary>
Expand Down Expand Up @@ -254,4 +255,3 @@ namespace MAT_NS_BEGIN

}
MAT_NS_END

6 changes: 5 additions & 1 deletion lib/system/EventProperty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,11 @@ namespace MAT_NS_BEGIN {
/// </summary>
EventProperty& EventProperty::operator=(const EventProperty& source)
{
if (this == &source)
{
return *this;
}

clear();
memcpy((void*)this, (void*)&source, sizeof(EventProperty));
copydata(&source);
Expand Down Expand Up @@ -958,4 +963,3 @@ namespace MAT_NS_BEGIN {
}

} MAT_NS_END

5 changes: 2 additions & 3 deletions lib/tracing/api/DebugProviders.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,8 @@ class ETWStringStream : public DebugStringStream<ETWStringStreamBuffer> {
guid.Data4[6] = buffer2[14];
guid.Data4[7] = buffer2[15];

delete buffer;
delete buffer2;
delete[] buffer;
delete[] buffer2;

return guid;
}
Expand Down Expand Up @@ -393,4 +393,3 @@ class ETWStringStream : public DebugStringStream<ETWStringStreamBuffer> {
#endif

#endif

9 changes: 9 additions & 0 deletions tests/unittests/EventPropertiesTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ TEST(EventPropertiesTests, Properties)
EXPECT_THAT(ep.GetPiiProperties(), IsEmpty());
}

TEST(EventPropertiesTests, SelfAssignmentPreservesValue)
{
EventProperty property("value");

property = property;

EXPECT_EQ(property, EventProperty("value"));
}

TEST(EventPropertiesTests, NumericProperties)
{
EventProperties ep("test");
Expand Down
Loading