mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
[wpiutil] uv Handle: Use malloc/free instead of new/delete (#3325)
This avoids asan warnings for deleting a different pointer type.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
@@ -288,7 +289,7 @@ class HandleImpl : public Handle {
|
||||
}
|
||||
|
||||
protected:
|
||||
HandleImpl() : Handle{reinterpret_cast<uv_handle_t*>(new U)} {}
|
||||
HandleImpl() : Handle{static_cast<uv_handle_t*>(std::malloc(sizeof(U)))} {}
|
||||
};
|
||||
|
||||
} // namespace wpi::uv
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
@@ -143,7 +144,8 @@ class NetworkStreamImpl : public NetworkStream {
|
||||
}
|
||||
|
||||
protected:
|
||||
NetworkStreamImpl() : NetworkStream{reinterpret_cast<uv_stream_t*>(new U)} {}
|
||||
NetworkStreamImpl()
|
||||
: NetworkStream{static_cast<uv_stream_t*>(std::malloc(sizeof(U)))} {}
|
||||
};
|
||||
|
||||
} // namespace wpi::uv
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <functional>
|
||||
#include <initializer_list>
|
||||
#include <memory>
|
||||
@@ -292,7 +293,7 @@ class StreamImpl : public Stream {
|
||||
}
|
||||
|
||||
protected:
|
||||
StreamImpl() : Stream{reinterpret_cast<uv_stream_t*>(new U)} {}
|
||||
StreamImpl() : Stream{static_cast<uv_stream_t*>(std::malloc(sizeof(U)))} {}
|
||||
};
|
||||
|
||||
} // namespace wpi::uv
|
||||
|
||||
Reference in New Issue
Block a user