Thomas Weidenmueller wine-patches@reactsoft.com writes:
@@ -1062,35 +1063,41 @@
if(Item->mask & LIF_ITEMID) {
if(!di->u.Link.szID)
if(di->u.Link.szID) {
di->u.Link.szID = Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR));
if(!Item->szID)
{
ERR("Unable to allocate memory for link id\n");
Ret = FALSE;
}
Free(di->u.Link.szID); }
nc = min(lstrlenW(Item->szID), MAX_LINKID_TEXT - 1);
di->u.Link.szID = Alloc((nc + 1) * sizeof(WCHAR)); if(di->u.Link.szID) {
lstrcpynW(di->u.Link.szID, Item->szID, MAX_LINKID_TEXT + 1);
lstrcpynW(di->u.Link.szID, Item->szID, nc + 1);
}
else
{
ERR("Unable to allocate memory for link id\n");
}Ret = FALSE; }
You should probably make sure that the new text has been allocated properly before freeing the old one, so that allocation errors don't cause the current contents to be lost.