Closed Bug 1715979 Opened 4 months ago Closed 4 months ago

DateTimePatternGenerator and Enumeration move assignment operator leaks

Categories

(Core :: Internationalization, defect, P1)

defect

Tracking

()

RESOLVED FIXED
91 Branch
Tracking Status
firefox91 --- fixed

People

(Reporter: anba, Assigned: gregtatum)

References

(Blocks 1 open bug)

Details

(Whiteboard: [i18n-unification])

Attachments

(1 file)

Enumeration& operator=(Enumeration&& other) noexcept {
  if (this != &other) {
    mUEnumeration = other.mUEnumeration;
    other.mUEnumeration = nullptr;
  }
}

The operator should call uenum_close before the assignment mUEnumeration = other.mUEnumeration.

A similar issue is present in DateTimePatternGenerator.

Severity: -- → S3
Flags: needinfo?(gtatum)
Priority: -- → P1

I don't think this is correct. Why would uenum_close be called when the pointer is being moved to another owner? The resource's ownership is being moved, and shouldn't be closed. Closing the resource, then transferring it to a new owner would cause a crash when the resource is then used.

Flags: needinfo?(gtatum)

this->mUEnumeration should be closed before it's overwritten with other.mUEnumeration, right?

Blocks: 1686965

Ah, I investigated this more, and yes you are correct. I don't think the current implementation leaks, but future uses can. This should be fixed.

Assignee: nobody → gtatum
Status: NEW → ASSIGNED
Pushed by gtatum@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/caa6a6bbe97d
Do not leak ICU objects in mozilla:intl component moves; r=nordzilla
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 91 Branch
Whiteboard: [i18n-unification]
You need to log in before you can comment on or make changes to this bug.