Closed Bug 235410 Opened 21 years ago Closed 21 years ago

LocaleObject leak in nsCollationOS2::CompareString()

Categories

(Core :: Internationalization, defect)

x86
OS/2
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bird-mozilla, Assigned: mkaply)

Details

Attachments

(1 file)

User-Agent:       
Build Identifier: Mozilla/5.0 (OS/2; U; Warp 4.5; en-US; rv:1.6) Gecko/20040117

There is a leak of 'LocalObject's in nsCollationOS2::CompareString()
(http://lxr.mozilla.org/seamonkey/source/intl/locale/src/os2/nsCollationOS2.cpp#78).
Before calling UniStrcoll() a local object, locObj, is created, however it's not
freed when the locObj variable goes out of scope at the end of the function.

Fix:
Add 'UniFreeLocaleObject(locObj);' at the end of the function.

Another problem, error handling is non existant. If someone else should leak
LocaleObject's that will eventually cause the create call to fail, even for
"en_US". The code should check the return code before calling UniStrcoll()
unless a crash is actually desired un such an occaction.

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Attached patch Fix per BirdSplinter Review
I can't believe this has been around this long. argh.
Assignee: smontagu → mkaply
Status: UNCONFIRMED → ASSIGNED
Attachment #142181 - Flags: review?(pedemont)
Attachment #142181 - Flags: review?(pedemont) → review+
fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 21 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: