Re: shell32: implement SHGetFolderPathAndSubDirA/W [2nd resend]
Zachary Goldberg schrieb: > On Mon, Mar 31, 2008 at 10:01 AM, Alexandre Julliard > <[EMAIL PROTECTED]> wrote: >> Stefan Leichter <[EMAIL PROTECTED]> writes: >> >> > +if (pszSubPath && (length = MultiByteToWideChar(CP_ACP, 0, >> pszSubPath, -1, NULL, 0))) { >> > +pszSubPathW = HeapAlloc(GetProcessHeap(), 0, length * >> sizeof(WCHAR)); >> > +if(!pszSubPathW) >> > +return HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY); >> >> You are leaking memory on error. Also I don't think it makes sense to >> test the return value of MultiByteToWideChar, it shouldn't fail in this >> case (or if you test it, then you need to handle the error properly, not >> use an empty path instead). >> >> -- >> Alexandre Julliard >> [EMAIL PROTECTED] >> >> >> > > Stefan, > > Any progress on this? > Yes, http://www.winehq.org/pipermail/wine-patches/2008-April/053246.html Stefan
Re: shell32: implement SHGetFolderPathAndSubDirA/W [2nd resend]
On Mon, Mar 31, 2008 at 10:01 AM, Alexandre Julliard <[EMAIL PROTECTED]> wrote: > Stefan Leichter <[EMAIL PROTECTED]> writes: > > > +if (pszSubPath && (length = MultiByteToWideChar(CP_ACP, 0, > pszSubPath, -1, NULL, 0))) { > > +pszSubPathW = HeapAlloc(GetProcessHeap(), 0, length * > sizeof(WCHAR)); > > +if(!pszSubPathW) > > +return HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY); > > You are leaking memory on error. Also I don't think it makes sense to > test the return value of MultiByteToWideChar, it shouldn't fail in this > case (or if you test it, then you need to handle the error properly, not > use an empty path instead). > > -- > Alexandre Julliard > [EMAIL PROTECTED] > > > Stefan, Any progress on this? -- Zachary Goldberg Computer Science & Engineering Electrical Captain of Penn Electric Race Team School of Engineering at the University of Pennsylvania
Re: shell32: implement SHGetFolderPathAndSubDirA/W [2nd resend]
Stefan Leichter <[EMAIL PROTECTED]> writes: > +if (pszSubPath && (length = MultiByteToWideChar(CP_ACP, 0, pszSubPath, > -1, NULL, 0))) { > +pszSubPathW = HeapAlloc(GetProcessHeap(), 0, length * sizeof(WCHAR)); > +if(!pszSubPathW) > +return HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY); You are leaking memory on error. Also I don't think it makes sense to test the return value of MultiByteToWideChar, it shouldn't fail in this case (or if you test it, then you need to handle the error properly, not use an empty path instead). -- Alexandre Julliard [EMAIL PROTECTED]