/* We should be using g_io_create_watch(), but can't without
* changing the driver API, as the callback signature is different.
*/
-#ifdef G_OS_WIN32
+#ifdef _WIN32
g_io_channel_win32_make_pollfd(channel, events, &pollfd);
#else
pollfd.fd = g_io_channel_unix_get_fd(channel);
logic_copy->length = logic->length;
logic_copy->unitsize = logic->unitsize;
logic_copy->data = g_malloc(logic->length * logic->unitsize);
- if (!logic_copy->data)
+ if (!logic_copy->data) {
+ g_free(logic_copy);
return SR_ERR;
+ }
memcpy(logic_copy->data, logic->data, logic->length * logic->unitsize);
(*copy)->payload = logic_copy;
break;