Summary Files Commits Branches @commit @diff @stats
path: root / src / message.cpp
diff options
context:
space:
mode:
Commitbef1b7e46471f1668d2c84380ef685a15defe06a (patch)
Author
 Syndamia <kamen@syndamia.com>
2025-07-03 14:55:34 +0300
Committer
 Syndamia <kamen@syndamia.com>
2025-07-03 14:55:34 +0300
Files410d72ceaa8987cfa868ffe64d94611a9b218be0 /src/message.cpp
iso-tp-parser-carista-bef1b7e46471f1668d2c84380ef685a15defe06a.tar
iso-tp-parser-carista-bef1b7e46471f1668d2c84380ef685a15defe06a.tar.gz
iso-tp-parser-carista-bef1b7e46471f1668d2c84380ef685a15defe06a.zip
Parent847a5544652b380b9393ff1b1ec2373de190d4f3 (diff)
fix: Replace mallocs with new
1 files changed, 2 insertions, 2 deletions
-rw-r--r--src/message.cpp4
diff --git a/src/message.cpp b/src/message.cpp
index 809a58b..af3168c 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -3,12 +3,12 @@
Message::Message(unsigned int can_id, const Frame& first_frame) : can_id(can_id), received(0) {
this->size = first_frame.get_size();
- this->msg = (unsigned char*)malloc(sizeof(unsigned char) * this->size);
+ this->msg = new unsigned char[this->size];
this->receive_frame(first_frame);
}
Message::Message(const Message& rhs) : can_id(rhs.can_id), size(rhs.size), received(rhs.received) {
- this->msg = (unsigned char*)malloc(sizeof(unsigned char) * this->size);
+ this->msg = new unsigned char[this->size];
std::memcpy(this->msg, rhs.msg, this->size);
}