summaryrefslogtreecommitdiff
path: root/src/RangeBtMessage.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/RangeBtMessage.cc')
-rw-r--r--src/RangeBtMessage.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/RangeBtMessage.cc b/src/RangeBtMessage.cc
index 5cf3940c..2f811ce7 100644
--- a/src/RangeBtMessage.cc
+++ b/src/RangeBtMessage.cc
@@ -45,7 +45,7 @@ RangeBtMessage::RangeBtMessage(uint8_t id, const char* name, size_t index,
{
}
-unsigned char* RangeBtMessage::createMessage()
+std::vector<unsigned char> RangeBtMessage::createMessage()
{
/**
* len --- 13, 4bytes
@@ -55,8 +55,8 @@ unsigned char* RangeBtMessage::createMessage()
* length -- length, 4bytes
* total: 17bytes
*/
- auto msg = new unsigned char[MESSAGE_LENGTH];
- bittorrent::createPeerMessageString(msg, MESSAGE_LENGTH, 13, getId());
+ auto msg = std::vector<unsigned char>(MESSAGE_LENGTH);
+ bittorrent::createPeerMessageString(msg.data(), MESSAGE_LENGTH, 13, getId());
bittorrent::setIntParam(&msg[5], index_);
bittorrent::setIntParam(&msg[9], begin_);
bittorrent::setIntParam(&msg[13], length_);