Closed Bug 211276 Opened 21 years ago Closed 21 years ago

nsStaticCaseInsensitiveNameTable::Init doesn't check the return value of PL_DHashTableInit

Categories

(Core :: XPCOM, defect)

x86
Windows 2000
defect
Not set
minor

Tracking

()

RESOLVED FIXED

People

(Reporter: timeless, Assigned: timeless)

References

()

Details

Attachments

(1 file, 1 obsolete file)

This is a code inspection bug. QA: To verify that this bug is fixed, make sure that all callers in of PL_DHashTableInit in the indicated class/file check and handle a failure return result. To verify that this bug is invalid, simply verify (e.g. with lxr) that PL_DHashTableInit is no longer used by the indicated class/file. PL_DHashTableInit returns a PRBool indicating whether it succeeded. PL_DHashTableInit *can* fail. Code can not assume that table->ops or table- >data will be null (in fact it probably will not be), although in all likelyhood table->entryStore will be null it probably isn't safe to assume this. Code at time of bug filing: 131 mNameArray = (nsDependentCString*)nsMemory::Alloc(Count * sizeof (nsDependentCString)); 132 PL_DHashTableInit(&mNameTable, &nametable_CaseInsensitiveHashTableOps, 133 nsnull, sizeof(nameTableEntry), Count); 134 if (!mNameArray || !mNameTable.ops) { 135 return PR_FALSE; 136 }
Attached patch proposed patch (obsolete) — Splinter Review
Attachment #126835 - Flags: superreview?(dbaron)
Attachment #126835 - Flags: review?(alecf)
Comment on attachment 126835 [details] [diff] [review] proposed patch If you're going to bother writing the code to handle out-of-memory here, you should fix the destructor as well.
Attachment #126835 - Flags: superreview?(dbaron) → superreview-
Attachment #126835 - Flags: review?(alecf)
Attachment #126835 - Attachment is obsolete: true
Attachment #127031 - Flags: superreview?(dbaron)
Attachment #127031 - Flags: superreview?(dbaron)
Attachment #127031 - Flags: superreview+
Attachment #127031 - Flags: review?(alecf)
Comment on attachment 127031 [details] [diff] [review] -uwp11, 4 space indentation, fixes destructor r=alecf
Attachment #127031 - Flags: review?(alecf) → review+
checked in
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

Creator:
Created:
Updated:
Size: