On Fri, Jan 10, 2014 at 5:38 AM, Alistair Leslie-Hughes leslie_alistair@hotmail.com wrote:
Hi, Remove pointer checks
Changelog: dpnet: Partial Implement IDirectPlay8Peer SetPeerInfo
Hi, I'm not used to review patches but please take a look at the points below.
+ if(This->peername) + HeapFree(GetProcessHeap(), 0, This->peername);
+ if(This->data) + HeapFree(GetProcessHeap(), 0, This->data); + You don't need to check for NULL.
+ len = lstrlenW(pdpnPlayerInfo->pwszName); + This->peername = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + memcpy(This->peername, pdpnPlayerInfo->pwszName, len * sizeof(WCHAR));
If peername is a string don't you need a len + 1 to mark NULL in the end? I'm not sure but since you can use lstrlenW can't you use heap_strdupW?
+ This->data = HeapAlloc(GetProcessHeap(), 0, pdpnPlayerInfo->dwDataSize); + memcpy(This->data, pdpnPlayerInfo->pvData, pdpnPlayerInfo->dwDataSize);
Don't you need to store the dwDataSize in datasize you created in the struct?
Best Regards Alistair Leslie-Hughes
Best regards, Bruno