SHGetMalloc API call is deprecated

RESOLVED INVALID

Status

Core Graveyard
Embedding: ActiveX Wrapper
RESOLVED INVALID
13 years ago
6 years ago

People

(Reporter: David Gardiner, Unassigned)

Tracking

Trunk
x86
Windows XP
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

13 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0

According to the MSDN documentation
(http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/functions/shgetmalloc.asp)


"This function should no longer be used. Use the CoTaskMemFree and
CoTaskMemAlloc functions in its place"

Both of these other functions are supported from Win95/NT3.1 so it is probably a
good idea to update our code.

This API call is used in the following locations:

/embedding/browser/activex/src/control/DropTarget.cpp, line 108 -- if
(FAILED(SHGetMalloc(&spMalloc)))
/embedding/browser/activex/src/control/MozillaBrowser.cpp, line 1945 --
SHGetMalloc(&shellMalloc);
/embedding/browser/activex/src/control_kicker/control_kicker.cpp, line 224 --
SHGetMalloc(&pShellAllocator);
/embedding/browser/activex/tests/IEPatcher/ScanForFilesDlg.cpp, line 82 --
SHGetMalloc(&pShellAllocator);
/embedding/browser/activex/tests/RegMozCtl/RegMozCtlDlg.cpp, line 219 --
SHGetMalloc(&pShellAllocator);
/modules/libpr0n/decoders/icon/win/nsIconChannel.cpp, line 265 -- hr =
::SHGetMalloc(&pMalloc);
/netwerk/protocol/file/src/nsFileProtocolHandler.cpp, line 121 -- result =
SHGetMalloc(&pMalloc);
/xpcom/io/SpecialSystemDirectory.cpp, line 197 -- if
(!SUCCEEDED(SHGetMalloc(&pMalloc)))
/xpcom/obsolete/nsSpecialSystemDirectory.cpp, line 216 -- if
(!SUCCEEDED(SHGetMalloc(&pMalloc)))
/widget/src/windows/nsFilePicker.cpp, line 169 -- ::SHGetMalloc(&pMalloc);
/toolkit/mozapps/installer/windows/wizard/setup/dialogs.c, line 653 -- if
(SUCCEEDED(SHGetMalloc(&shellMalloc))) {
/toolkit/xre/nsXREDirProvider.cpp, line 598 -- if
(!SUCCEEDED(SHGetMalloc(&pMalloc)))
/browser/components/migration/src/nsIEProfileMigrator.cpp, line 1236 -- result =
SHGetMalloc(&pMalloc);

I stumbled upon this after running a PREfast static analysis of the Mozilla
code, which also produced this warning for a couple of uses of SHGetMalloc:

control_kicker.cpp(224): warning 31: Return value ignored: 'SHGetMalloc' could
return unexpected value. problem occurs in function 'LoadMozLibraryFromRegistry'

(and also here too)
warning 31 : Return value ignored: 'SHGetMalloc' could return unexpected value.
             File path: d:\mozilla\mozilla\widget\src\windows\nsfilepicker.cpp
             Function: nsFilePicker::ShowW
             Line: 169 

As an aside there's also an interesting blog article that talks about
SHGetMalloc here: http://weblogs.asp.net/oldnewthing/archive/2004/07/05/173226.aspx

-dave

Reproducible: Always

Steps to Reproduce:
David, you probably want to file one bug per module that uses this call (since
they will need to be fixed by different people).  Then make all the bugs you
file block this bug so it can be used to track progress on fixing this....
(Reporter)

Updated

13 years ago
Blocks: 283681
(Reporter)

Updated

13 years ago
Depends on: 284156
(Reporter)

Updated

13 years ago
Depends on: 284158
(Reporter)

Updated

13 years ago
Depends on: 284324
(Reporter)

Updated

13 years ago
Depends on: 284327
(Reporter)

Updated

13 years ago
Depends on: 284329
(Reporter)

Updated

13 years ago
Depends on: 284331
(Reporter)

Updated

13 years ago
Depends on: 284333

Comment 2

13 years ago
David has review for most of the sub-bugs, but forgot to ask SR ? The patch are
at risk of bit rotting.

Only 284331 and 284156 still miss the review ...
Isn't the real issue that no one ever requested approval for those patches and
we're in a freeze?

If the patches are safe, please request 1.8b2 approval for them; once thye have
approvals please ping me and I can check them in...
QA Contact: dunn5557 → activex

Comment 4

6 years ago
The ActiveX embedding API was removed in bug 662023 and friends, making this INVALID.

[Filter bugspam on activexinvalid]
Assignee: adamlock → nobody
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → INVALID
(Assignee)

Updated

6 years ago
Component: Embedding: ActiveX Wrapper → Embedding: ActiveX Wrapper
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.