Skip to content

Commit

Permalink
Bug 1431204 - Only addref the mutator if is not null r=mayhemer
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: 94VsIsLxx2T

--HG--
extra : rebase_source : 3608e624bd8dce13ac7a5dac45a3522b3b685460
  • Loading branch information
valenting committed Jan 19, 2018
1 parent da90b10 commit 8944589
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion caps/NullPrincipalURI.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ class NullPrincipalURI final : public nsIURI

NS_IMETHOD SetSpec(const nsACString & aSpec, nsIURIMutator** aMutator) override
{
NS_ADDREF(*aMutator = this);
if (aMutator) {
nsCOMPtr<nsIURIMutator> mutator = this;
mutator.forget(aMutator);
}
return NS_ERROR_NOT_IMPLEMENTED;
}

Expand Down
8 changes: 6 additions & 2 deletions image/decoders/icon/nsIconURI.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,12 @@ class nsMozIconURI final
return NS_OK;
}

NS_IMETHOD SetSpec(const nsACString & aSpec, nsIURIMutator** aMutator) override {
NS_ADDREF(*aMutator = this);
NS_IMETHOD SetSpec(const nsACString & aSpec, nsIURIMutator** aMutator) override
{
if (aMutator) {
nsCOMPtr<nsIURIMutator> mutator = this;
mutator.forget(aMutator);
}
return InitFromSpec(aSpec);
}

Expand Down

0 comments on commit 8944589

Please sign in to comment.