Commit bdd7d8bc authored by Juergen Schmied's avatar Juergen Schmied Committed by Alexandre Julliard

Fixed two leaks in file- and itemmoniker.

parent 2c5a41b0
......@@ -870,21 +870,18 @@ HRESULT WINAPI FileMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker
IMoniker_GetClassID(pmkOtherMoniker,&clsid);
if (!IsEqualCLSID(&clsid,&CLSID_FileMoniker))
return S_FALSE;
res=CreateBindCtx(0,&bind);
if (FAILED(res))
return res;
IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&filePath);
res = CreateBindCtx(0,&bind);
if (FAILED(res)) return res;
if (lstrcmpiW(filePath,
This->filePathName)!=0)
return S_FALSE;
if (SUCCEEDED(IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&filePath))) {
int result = lstrcmpiW(filePath, This->filePathName);
CoTaskMemFree(filePath);
if ( result == 0 ) return S_OK;
}
return S_FALSE;
return S_OK;
}
/******************************************************************************
......
......@@ -387,20 +387,20 @@ HRESULT WINAPI ItemMonikerImpl_Construct(ItemMonikerImpl* This, LPCOLESTR lpszDe
This->itemName=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(sizeStr1+1));
if (!This->itemName)
return E_OUTOFMEMORY;
strcpyW(This->itemName,lpszItem);
lstrcpyW(This->itemName,lpszItem);
if (!lpszDelim)
FIXME("lpszDelim is NULL. Using empty string which is possibly wrong.\n");
delim = lpszDelim ? lpszDelim : emptystr;
sizeStr2=strlenW(delim);
sizeStr2=lstrlenW(delim);
This->itemDelimiter=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(sizeStr2+1));
if (!This->itemDelimiter) {
HeapFree(GetProcessHeap(),0,This->itemName);
return E_OUTOFMEMORY;
}
strcpyW(This->itemDelimiter,delim);
lstrcpyW(This->itemDelimiter,delim);
return S_OK;
}
......@@ -611,32 +611,28 @@ HRESULT WINAPI ItemMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker
CLSID clsid;
LPOLESTR dispName1,dispName2;
IBindCtx* bind;
HRESULT res;
HRESULT res = S_FALSE;
TRACE("(%p,%p)\n",iface,pmkOtherMoniker);
if (pmkOtherMoniker==NULL)
return S_FALSE;
/* This method returns S_OK if both monikers are item monikers and their display names are */
/* identical (using a case-insensitive comparison); otherwise, the method returns S_FALSE. */
IMoniker_GetClassID(pmkOtherMoniker,&clsid);
if (!IsEqualCLSID(&clsid,&CLSID_ItemMoniker))
return S_FALSE;
res=CreateBindCtx(0,&bind);
if (FAILED(res))
return res;
if (!pmkOtherMoniker) return S_FALSE;
IMoniker_GetDisplayName(iface,bind,NULL,&dispName1);
IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&dispName2);
if (lstrcmpW(dispName1,dispName2)!=0)
return S_FALSE;
/* check if both are ItemMoniker */
if(FAILED (IMoniker_GetClassID(pmkOtherMoniker,&clsid))) return S_FALSE;
if(!IsEqualCLSID(&clsid,&CLSID_ItemMoniker)) return S_FALSE;
return S_OK;
/* check if both displaynames are the same */
if(SUCCEEDED ((res = CreateBindCtx(0,&bind)))) {
if(SUCCEEDED (IMoniker_GetDisplayName(iface,bind,NULL,&dispName1))) {
if(SUCCEEDED (IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&dispName2))) {
if(lstrcmpW(dispName1,dispName2)==0) res = S_OK;
CoTaskMemFree(dispName2);
}
CoTaskMemFree(dispName1);
}
}
return res;
}
/******************************************************************************
......@@ -842,8 +838,8 @@ HRESULT WINAPI ItemMonikerImpl_GetDisplayName(IMoniker* iface,
if (*ppszDisplayName==NULL)
return E_OUTOFMEMORY;
strcpyW(*ppszDisplayName,This->itemDelimiter);
strcatW(*ppszDisplayName,This->itemName);
lstrcpyW(*ppszDisplayName,This->itemDelimiter);
lstrcatW(*ppszDisplayName,This->itemName);
return S_OK;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment