Closed Bug 1017835 Opened 10 years ago Closed 10 years ago

DataChannelConnection::SendPacket should use array delete

Categories

(Core :: WebRTC: Networking, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla33

People

(Reporter: erahm, Assigned: jesup)

Details

Attachments

(1 file)

The buffer[1] passed to |DataChannelConnection::SendPacket| is allocated with an array new, it should be freed with a corresponding array delete[2].


[1] http://dxr.mozilla.org/mozilla-central/source/netwerk/sctp/datachannel/DataChannel.cpp#716
[2] http://dxr.mozilla.org/mozilla-central/source/netwerk/sctp/datachannel/DataChannel.cpp#686
Attachment #8432263 - Flags: review?(jib)
Comment on attachment 8432263 [details] [diff] [review]
use array delete for SCTP/DTLS SendPacket data

Review of attachment 8432263 [details] [diff] [review]:
-----------------------------------------------------------------

Comments optional.

::: netwerk/sctp/datachannel/DataChannel.cpp
@@ +678,4 @@
>  }
>  
>  int
>  DataChannelConnection::SendPacket(const unsigned char *data, size_t len, bool release)

I find const here a little weird when transferring ownership.

Also, how about DataChannelConnection::SendPacket(unsigned char data [], size_t len, bool release) to hint that an array is expected?
Attachment #8432263 - Flags: review?(jib) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/f04ad92a05ea
Forgot to add the r=jib...
Target Milestone: --- → mozilla33
Comment on attachment 8432263 [details] [diff] [review]
use array delete for SCTP/DTLS SendPacket data

Review of attachment 8432263 [details] [diff] [review]:
-----------------------------------------------------------------

::: netwerk/sctp/datachannel/DataChannel.cpp
@@ +678,4 @@
>  }
>  
>  int
>  DataChannelConnection::SendPacket(const unsigned char *data, size_t len, bool release)

If you're going to transfer ownership, wouldn't it make more sense to use a smart pointer instead to delineate this clearly?
https://hg.mozilla.org/mozilla-central/rev/c34082c15a99
Assignee: nobody → rjesup
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: