Closed Bug 108808 Opened 23 years ago Closed 23 years ago

CallQueryInterface() null-safety in form controls

Categories

(Core :: Layout: Form Controls, defect)

x86
Linux
defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: john, Assigned: john)

Details

Attachments

(1 file)

I've gone through and found a few places where CallQueryInterface() is being
called without setting the pointer to null first.  This is bad, even if the
chances are slim of it failing.  Patch attached.
looks good r=rods
Comment on attachment 56856 [details] [diff] [review]
Set stuff to null before CallQueryInterface()

sr=kin@netscape.com

So I noticed that the methods you touched don't set the value of the 
return arg aFrame/aScrollableView, in the case where the result of the QI is null, but they still return NS_OK.

Should we be playing it safe and setting them to nsnull too, just in case the caller didn't initialize them?
Attachment #56856 - Flags: superreview+
Attachment #56856 - Flags: review+
I am not sure about that one ... is there a general contract for getter
interfaces?  My feeling was you were supposed to initialize to null outside.

I think we should initialize outside or inside, but not both.
checked in.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
marking verified based on developer's comments
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: