diff --git a/plugins/cros-ec/fu-cros-ec-usb-device.c b/plugins/cros-ec/fu-cros-ec-usb-device.c index 23c98a05a..8a0423468 100644 --- a/plugins/cros-ec/fu-cros-ec-usb-device.c +++ b/plugins/cros-ec/fu-cros-ec-usb-device.c @@ -202,15 +202,16 @@ fu_cros_ec_usb_device_do_xfer (FuCrosEcUsbDevice * self, const guint8 *outbuf, { GUsbDevice *usb_device = fu_usb_device_get_dev (FU_USB_DEVICE (self)); gsize actual = 0; - g_autofree guint8 *outbuf_tmp = NULL; - - /* make mutable */ - outbuf_tmp = fu_memdup_safe (outbuf, outlen, error); - if (outbuf_tmp == NULL) - return FALSE; /* send data out */ if (outbuf != NULL && outlen > 0) { + g_autofree guint8 *outbuf_tmp = NULL; + + /* make mutable */ + outbuf_tmp = fu_memdup_safe (outbuf, outlen, error); + if (outbuf_tmp == NULL) + return FALSE; + if (!g_usb_device_bulk_transfer (usb_device, self->ep_num, outbuf_tmp, outlen, &actual, BULK_SEND_TIMEOUT_MS,