Closed Bug 1317660 Opened 8 years ago Closed 8 years ago

Fix CID 1394336: Resource leaks in TestAudioPacketizer.cpp

Categories

(Core :: WebRTC: Audio/Video, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed

People

(Reporter: JamesCheng, Assigned: JamesCheng)

Details

Attachments

(1 file)

If the assertion_true not passed, it will not delete the buffer resource and cause a leak[1].

Just a simple fix.

[1]
http://searchfox.org/mozilla-central/rev/886d5186f0598ab2f8a9953eb5a4dab9750ef834/dom/media/gtest/TestAudioPacketizer.cpp#157
Attachment #8810797 - Flags: review?(padenot)
Comment on attachment 8810797 [details]
Bug 1317660 - Fix CID 1394336: Resource leaks in TestAudioPacketizer.cpp

https://reviewboard.mozilla.org/r/93136/#review93174

Can you implement my suggestion and land ? Thanks !

::: dom/media/gtest/TestAudioPacketizer.cpp:154
(Diff revision 1)
>            }
>            phase++;
>          }
>          ap.Input(b.Get(), 128);
>          while (ap.PacketsAvailable()) {
>            int16_t* packet = ap.Output();

std::unique_ptr<int16_t>, this will call the destructor automatically when returning from the function in `ASSERT_TRUE`.

::: dom/media/gtest/TestAudioPacketizer.cpp:167
(Diff revision 1)
> +              }
> +              ASSERT_TRUE(result);
>              }
>              outPhase++;
>            }
>            delete [] packet;

We can remove this with the unique_ptr.
Attachment #8810797 - Flags: review?(padenot) → review+
Sure thank you.
Comment on attachment 8810797 [details]
Bug 1317660 - Fix CID 1394336: Resource leaks in TestAudioPacketizer.cpp

Hi padenot,

Could you please review it again?

I use unique_ptr to replace all raw pointer usage.

Thanks.
Attachment #8810797 - Flags: review+ → review?(padenot)
Comment on attachment 8810797 [details]
Bug 1317660 - Fix CID 1394336: Resource leaks in TestAudioPacketizer.cpp

https://reviewboard.mozilla.org/r/93136/#review93466
Attachment #8810797 - Flags: review?(padenot) → review+
Rank: 33
Priority: -- → P3
Thanks for review.
Keywords: checkin-needed
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/637eeed7d0d2
Fix CID 1394336: Resource leaks in TestAudioPacketizer.cpp r=padenot
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/637eeed7d0d2
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: