зеркало из https://github.com/mozilla/gecko-dev.git
Bug 982072 - Don't leak the argument passed to RegisterStrongMemoryReporter if we fail to get the service; r=froydnj
This commit is contained in:
Родитель
0d3ad74d44
Коммит
8d63d692dd
|
@ -1741,12 +1741,16 @@ namespace mozilla {
|
||||||
nsresult
|
nsresult
|
||||||
RegisterStrongMemoryReporter(nsIMemoryReporter* aReporter)
|
RegisterStrongMemoryReporter(nsIMemoryReporter* aReporter)
|
||||||
{
|
{
|
||||||
|
// Hold a strong reference to the argument to make sure it gets released if
|
||||||
|
// we return early below.
|
||||||
|
nsCOMPtr<nsIMemoryReporter> reporter = aReporter;
|
||||||
|
|
||||||
nsCOMPtr<nsIMemoryReporterManager> mgr =
|
nsCOMPtr<nsIMemoryReporterManager> mgr =
|
||||||
do_GetService("@mozilla.org/memory-reporter-manager;1");
|
do_GetService("@mozilla.org/memory-reporter-manager;1");
|
||||||
if (!mgr) {
|
if (!mgr) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
return mgr->RegisterStrongReporter(aReporter);
|
return mgr->RegisterStrongReporter(reporter);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
Загрузка…
Ссылка в новой задаче