CallQueryInterface() null-safety in form controls

VERIFIED FIXED

Status

()

Core
Layout: Form Controls
VERIFIED FIXED
16 years ago
16 years ago

People

(Reporter: John Keiser (jkeiser), Assigned: John Keiser (jkeiser))

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

16 years ago
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.
(Assignee)

Comment 1

16 years ago
Created attachment 56856 [details] [diff] [review]
Set stuff to null before CallQueryInterface()

Comment 2

16 years ago
looks good r=rods

Comment 3

16 years ago
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+
(Assignee)

Comment 4

16 years ago
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.
(Assignee)

Comment 5

16 years ago
checked in.
Status: NEW → RESOLVED
Last Resolved: 16 years ago
Resolution: --- → FIXED

Comment 6

16 years ago
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.