Closed Bug 211277 Opened 21 years ago Closed 21 years ago

nsPersistentProperties::nsPersistentProperties 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: 120 nsPersistentProperties::nsPersistentProperties() 121 { 122 mIn = nsnull; 123 mSubclass = NS_STATIC_CAST(nsIPersistentProperties*, this); 124 PL_DHashTableInit(&mTable, &property_HashTableOps, nsnull, 125 sizeof(propertyTableEntry), 20); 126 127 PL_INIT_ARENA_POOL(&mArena, "PersistentPropertyArena", 2048); 128 129 } 137 NS_METHOD 138 nsPersistentProperties::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult) 139 { 140 if (aOuter) 141 return NS_ERROR_NO_AGGREGATION; 142 nsPersistentProperties* props = new nsPersistentProperties(); 143 if (props == nsnull) 144 return NS_ERROR_OUT_OF_MEMORY;
Attached patch proposed fix (obsolete) — Splinter Review
this also includes a warning fix from rev 1.33 which alecf rolled back in 1.38. it's past 1.4 and i'd like to kill the warning :)
Attachment #126837 - Flags: superreview?(dbaron)
Attachment #126837 - Flags: review?(alecf)
Comment on attachment 126837 [details] [diff] [review] proposed fix It's rather unusual to do this type of thing in a factory function. Could you create an Init method instead? (It could be inline if you want.)
Attachment #126837 - Flags: superreview?(dbaron) → superreview-
Attachment #126837 - Flags: review?(alecf)
Attached patch w/ init methodSplinter Review
Attachment #126837 - Attachment is obsolete: true
Attachment #127057 - Flags: superreview?(dbaron)
Attachment #127057 - Flags: review?(alecf)
Attachment #127057 - Flags: superreview?(dbaron) → superreview+
Comment on attachment 127057 [details] [diff] [review] w/ init method sr=alecf
Attachment #127057 - Flags: review?(alecf) → review+
checked in
checked in
Status: NEW → 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: