ole32: Fix outstanding memory leak (coverity)
Frédéric Delanoy
frederic.delanoy at gmail.com
Sat Nov 10 10:40:19 CST 2012
On Sat, Nov 10, 2012 at 3:57 PM, André Hentschel <nerv at dawncrow.de> wrote:
> ---
> dlls/ole32/storage32.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
> index 8498eaf..4099df6 100644
> --- a/dlls/ole32/storage32.c
> +++ b/dlls/ole32/storage32.c
> @@ -9067,17 +9067,16 @@ static HRESULT OLECONVERT_GetOLE10ProgID(LPSTORAGE pStorage, char *strProgID, DW
> else
> {
> STATSTG stat;
> - LPOLESTR wstrProgID;
> + LPOLESTR wstrProgID = NULL;
>
> /* Get the OleType from the registry */
> REFCLSID clsid = &(stat.clsid);
> IStorage_Stat(pStorage, &stat, STATFLAG_NONAME);
> hRes = ProgIDFromCLSID(clsid, &wstrProgID);
> if(hRes == S_OK)
> - {
> *dwSize = WideCharToMultiByte(CP_ACP, 0, wstrProgID, -1, strProgID, *dwSize, NULL, FALSE);
> + if(wstrProgID)
> CoTaskMemFree(wstrProgID);
> - }
CoTaskMemFree is no-op when given NULL argument so "if(wstrProgID)" is
not necessary (since you initialize it to NULL)
Frédéric
More information about the wine-devel
mailing list