[2/2] dpnet: Partial Implement IDirectPlay8Peer SetPeerInfo (try 2)

Bruno Jesus 00cpxxx at gmail.com
Fri Jan 10 04:35:58 CST 2014


On Fri, Jan 10, 2014 at 5:38 AM, Alistair Leslie-Hughes
<leslie_alistair at 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



More information about the wine-devel mailing list