On 06/09/11 23:11, Adam Stokes wrote:
+ if (UuidToStringA(&u,&rs) == RPC_S_OK) {
+ wchar_t *s_ws = NULL;
+ strncpy(s, (char *)rs, MAXUUIDLEN);
+ s[sizeof(s) - 1] = '\0';
+ RpcStringFreeA(&rs);
+ mh_trace("Got uuid: %s", s);
+ s_ws = char2wide(s);
+ lSuccess = RegSetValueEx(hKey, szValue, 0, REG_SZ, (CONST BYTE *)s_ws,
+ wcslen(s_ws) * sizeof(wchar_t *));
+ free(s_ws);
+ free(szValue);
+ if (lSuccess != ERROR_SUCCESS) {
+ goto bail;
See the previous thread for most of my comments, but also note that an
error here results in a double-free() of szValue.
+ }
+ }
+ return s;
+ bail:
+ free(szValue);
+ return "";
+}