Teach AudioStream::EnsureTimeStretcherInitialized() about infallible malloc

RESOLVED FIXED in mozilla20

Status

()

defect
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: dholbert, Assigned: padenot)

Tracking

Trunk
mozilla20
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Reporter

Description

7 years ago
Just noticed this chunk go by in a patch for bug 814708:

>+++ b/content/media/AudioStream.cpp
> bool AudioStream::EnsureTimeStretcherInitialized()
[...]
>-  soundtouch::SoundTouch* state = new soundtouch::SoundTouch();
>-  if (!state) {
>+  mTimeStretcher = new soundtouch::SoundTouch();
>+  if (!mTimeStretcher) {
>     return false;
>   }

I'm pretty sure we don't need to bother with the null-check-after-new for mTimeStretcher (or "state" in the pre-patched code), since we have infallible-malloc.  (Unless this code has somehow requested a different malloc impl)

Incidentally, that also means that EnsureTimeStretcherInitialized can become infallible (return void instead of bool) itself.   This might mean some callers can be cleaned up as well -- I didn't follow the chain up further than that.
Assignee

Comment 1

7 years ago
Indeed we use infaillible malloc.
Attachment #686502 - Flags: review?(kinetik)
Assignee

Updated

7 years ago
Assignee: nobody → paul
Attachment #686502 - Flags: review?(kinetik) → review+
https://hg.mozilla.org/mozilla-central/rev/ccabd35aa7d4
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
You need to log in before you can comment on or make changes to this bug.