Closed Bug 211288 Opened 21 years ago Closed 10 years ago

void nsTemplateMap::Init doesn't check the return value of PL_DHashTableInit

Categories

(Core :: XUL, defect)

x86
Windows 2000
defect
Not set
minor

Tracking

()

RESOLVED DUPLICATE of bug 911246

People

(Reporter: timeless, Unassigned)

References

()

Details

Attachments

(1 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: 55 void 56 Init() { PL_DHashTableInit(&mTable, PL_DHashGetStubOps(), nsnull, sizeof(Entry), PL_DHASH_MIN_SIZE); }
Attached patch patchSplinter Review
Attachment #128530 - Flags: superreview?(bzbarsky)
Attachment #128530 - Flags: review?(dbaron)
Attachment #128530 - Flags: superreview?(bzbarsky) → superreview+
Comment on attachment 128530 [details] [diff] [review] patch You can't return an nsresult from a void function. You're also changing the semantics of the assertion in |Remove|. While you're here, |Entry| ought to inherit from PLDHashEntryHdr so you can use NS_STATIC_CAST rather than NS_REINTERPRET_CAST. sr-
Attachment #128530 - Flags: review?(dbaron) → review-
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: shrir → xptoolkit.widgets
Assignee: hyatt → nobody
The init method is infallible now.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: