mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1021151 - avoid memory leak in NS_GENERIC_AGGREGATED_CONSTRUCTOR_INIT, use nsAutoPtr instead of naked ptr. r=Ehsan
MozReview-Commit-ID: 6iU7ikbgjEn
This commit is contained in:
parent
1a29056508
commit
50bbc8e987
@ -295,16 +295,13 @@ _InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID, \
|
||||
if (NS_WARN_IF(aOuter && !aIID.Equals(NS_GET_IID(nsISupports)))) \
|
||||
return NS_ERROR_INVALID_ARG; \
|
||||
\
|
||||
_InstanceClass* inst = new _InstanceClass(aOuter); \
|
||||
RefPtr<_InstanceClass> inst = new _InstanceClass(aOuter); \
|
||||
if (!inst) { \
|
||||
return NS_ERROR_OUT_OF_MEMORY; \
|
||||
} \
|
||||
\
|
||||
nsISupports* inner = inst->InnerObject(); \
|
||||
nsresult rv = inner->QueryInterface(aIID, aResult); \
|
||||
if (NS_FAILED(rv)) { \
|
||||
delete inst; \
|
||||
} \
|
||||
\
|
||||
return rv; \
|
||||
} \
|
||||
@ -318,7 +315,7 @@ _InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID, \
|
||||
if (NS_WARN_IF(aOuter && !aIID.Equals(NS_GET_IID(nsISupports)))) \
|
||||
return NS_ERROR_INVALID_ARG; \
|
||||
\
|
||||
_InstanceClass* inst = new _InstanceClass(aOuter); \
|
||||
RefPtr<_InstanceClass> inst = new _InstanceClass(aOuter); \
|
||||
if (!inst) { \
|
||||
return NS_ERROR_OUT_OF_MEMORY; \
|
||||
} \
|
||||
|
Loading…
Reference in New Issue
Block a user