The memory buffers in Release/include/cpprest/streams.h deallocate with delete instead of delete[]. The result (at least on Linux) is memory corruption.
Here's the fix patch:
diff --git a/Release/include/cpprest/streams.h b/Release/include/cpprest/streams.h
index 21fe3eb..2b6f98f 100644
--- a/Release/include/cpprest/streams.h
+++ b/Release/include/cpprest/streams.h
@@ -251,7 +251,10 @@ namespace Concurrency { namespace streams
source.release(data, 0);
}
- std::shared_ptr<CharType> buf(new CharType[count]);
+ std::shared_ptr<CharType> buf(new CharType[count], [](CharType* buf)
+ {
+ delete [] buf;
+ });
auto post_write =
[buf](pplx::task<size_t> op)-> pplx::task<size_t>
@@ -723,7 +726,11 @@ namespace Concurrency { namespace streams
buffer.release(data, 0);
}
- std::shared_ptr<CharType> buf(new CharType[count]);
+ std::shared_ptr<CharType> buf(new CharType[count], [](CharType* buf)
+ {
+ delete [] buf;
+ });
+
auto post_write =
[buf](pplx::task<size_t> op) -> pplx::task<size_t>
Here's the fix patch:
diff --git a/Release/include/cpprest/streams.h b/Release/include/cpprest/streams.h
index 21fe3eb..2b6f98f 100644
--- a/Release/include/cpprest/streams.h
+++ b/Release/include/cpprest/streams.h
@@ -251,7 +251,10 @@ namespace Concurrency { namespace streams
source.release(data, 0);
}
- std::shared_ptr<CharType> buf(new CharType[count]);
+ std::shared_ptr<CharType> buf(new CharType[count], [](CharType* buf)
+ {
+ delete [] buf;
+ });
auto post_write =
[buf](pplx::task<size_t> op)-> pplx::task<size_t>
@@ -723,7 +726,11 @@ namespace Concurrency { namespace streams
buffer.release(data, 0);
}
- std::shared_ptr<CharType> buf(new CharType[count]);
+ std::shared_ptr<CharType> buf(new CharType[count], [](CharType* buf)
+ {
+ delete [] buf;
+ });
+
auto post_write =
[buf](pplx::task<size_t> op) -> pplx::task<size_t>