Skip to content

fix: free BufferWriter packets with delete[] - #16

Open
AJ0070 wants to merge 1 commit into
ZoneMinder:masterfrom
AJ0070:buffer-writer-array-delete
Open

AJ0070 wants to merge 1 commit into
ZoneMinder:masterfrom
AJ0070:buffer-writer-array-delete

Conversation

@AJ0070

@AJ0070 AJ0070 commented Nov 13, 2026

Copy link
Copy Markdown

BufferWriter::Append allocates each packet with new char[size+512] but stores it in a shared_ptr<char> with the default deleter, which calls delete instead of delete[]. RtspConnection already passes std::default_delete<char[]>() for the same case.

An AddressSanitizer build of zm_rtsp_server aborts with alloc-dealloc-mismatch on the first packet sent to a client. A small program appending three packets to a BufferWriter reports the same error before this change and runs clean after it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant