Changeset 7336 for trunk/src


Ignore:
Timestamp:
Nov 14, 2001, 1:52:30 PM (24 years ago)
Author:
phaller
Message:

fixed memory leak and replaced heap alloc by stack alloc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/shell32/shelllink.c

    r6709 r7336  
    226226static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFileName, DWORD dwMode)
    227227{
    228         _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface)
     228        HRESULT         hRet = E_FAIL;
     229        LPSTR           sFile;
     230 
     231        _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface)
    229232        _IPersistStream_From_ICOM_THIS(IPersistStream, This)
    230233
    231         LPSTR           sFile = HEAP_strdupWtoA ( GetProcessHeap(), 0, pszFileName);
    232         HRESULT         hRet = E_FAIL;
     234#ifdef __WIN32OS2__
     235        STACK_strdupWtoA(pszFileName, sFile)
     236#else
     237        sFile = HEAP_strdupWtoA ( GetProcessHeap(), 0, pszFileName);
     238#endif
    233239
    234240        TRACE("(%p, %s)\n",This, sFile);
     
    242248          if SUCCEEDED (IPersistStream_Load(StreamThis, This->lpFileStream))
    243249          {
    244             return NOERROR;
     250            hRet = NOERROR;
    245251          }
    246252        }
    247253       
     254#ifndef __WIN32OS2__
     255       // PH 2001-11-13 memory leak in WINE?
     256       HeapFree( GetProcessHeap(), 0, sFile);
     257#endif
     258
    248259        return hRet;
    249260}
     
    11301141            HeapFree(GetProcessHeap(), 0, This->sArgs);
    11311142
     1143
    11321144          if (This->sWorkDir)
    11331145            HeapFree(GetProcessHeap(), 0, This->sWorkDir);
Note: See TracChangeset for help on using the changeset viewer.