Bug 1241370 - Don't strdup() the message name in InterruptFrame. r=billm.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 20 Jan 2016 19:00:01 -0800
changeset 281188 5d12e137f2c154dbbffb2cf9912709bcf9f594aa
parent 281187 406f2af156e70f008242c91eade94c50c7e8fdb3
child 281189 0947272393af5b921b4b1fbd888478536010d7b4
push id29930
push usercbook@mozilla.com
push dateFri, 22 Jan 2016 11:05:50 +0000
treeherdermozilla-central@7104d650a97d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm
bugs1241370
milestone46.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1241370 - Don't strdup() the message name in InterruptFrame. r=billm. It's not necessary, because all message names are string literals.
ipc/glue/MessageChannel.cpp
--- a/ipc/glue/MessageChannel.cpp
+++ b/ipc/glue/MessageChannel.cpp
@@ -136,17 +136,17 @@ private:
     {
         INTR_SEMS,
         SYNC_SEMS,
         ASYNC_SEMS
     };
 
 public:
     InterruptFrame(Direction direction, const Message* msg)
-      : mMessageName(strdup(msg->name())),
+      : mMessageName(msg->name()),
         mMessageRoutingId(msg->routing_id()),
         mMesageSemantics(msg->is_interrupt() ? INTR_SEMS :
                           msg->is_sync() ? SYNC_SEMS :
                           ASYNC_SEMS),
         mDirection(direction),
         mMoved(false)
     {
         MOZ_ASSERT(mMessageName);
@@ -162,19 +162,16 @@ public:
         mMessageRoutingId = aOther.mMessageRoutingId;
         mMesageSemantics = aOther.mMesageSemantics;
         mDirection = aOther.mDirection;
     }
 
     ~InterruptFrame()
     {
         MOZ_ASSERT_IF(!mMessageName, mMoved);
-
-        if (mMessageName)
-            free(const_cast<char*>(mMessageName));
     }
 
     InterruptFrame& operator=(InterruptFrame&& aOther)
     {
         MOZ_RELEASE_ASSERT(&aOther != this);
         this->~InterruptFrame();
         new (this) InterruptFrame(mozilla::Move(aOther));
         return *this;