初始化内存 (#1162)

This commit is contained in:
Xiaofeng Wang 2021-10-15 14:09:32 +08:00 committed by GitHub
parent 290b3f37a5
commit 2a2597a874
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -454,6 +454,7 @@ std::shared_ptr<RtcpSdes> RtcpSdes::create(const std::vector<string> &item_text)
auto real_size = sizeof(RtcpSdes) - sizeof(SdesChunk) + item_total_size;
auto bytes = alignSize(real_size);
auto ptr = (RtcpSdes *) new char[bytes];
memset(ptr, 0x00, bytes);
auto item_ptr = &ptr->chunks;
for (auto &text : item_text) {
item_ptr->txt_len = (0xFF & text.size());