fpcmoc: Copy the error before sending to the SSM

The SSM error is stolen and then we pass to the resume/suspend callback
potentially leading to a double-free.

So copy it before re-using it.

Reported by: Keith Linneman (LinnemanLabs)
This commit is contained in:
Marco Trevisan (Treviño)
2026-07-13 08:13:46 +00:00
committed by Marco Trevisan
parent 3138ad0c8a
commit 092c0dfc31
+2 -2
View File
@@ -92,7 +92,7 @@ fpc_suspend_resume_cb (FpiUsbTransfer *transfer,
if (ssm_state == FPC_CMD_SUSPENDED) if (ssm_state == FPC_CMD_SUSPENDED)
{ {
if (error) if (error)
fpi_ssm_mark_failed (transfer->ssm, error); fpi_ssm_mark_failed (transfer->ssm, g_error_copy (error));
fpi_device_suspend_complete (device, error); fpi_device_suspend_complete (device, error);
/* The resume handler continues to the next state! */ /* The resume handler continues to the next state! */
@@ -100,7 +100,7 @@ fpc_suspend_resume_cb (FpiUsbTransfer *transfer,
else if (ssm_state == FPC_CMD_RESUME) else if (ssm_state == FPC_CMD_RESUME)
{ {
if (error) if (error)
fpi_ssm_mark_failed (transfer->ssm, error); fpi_ssm_mark_failed (transfer->ssm, g_error_copy (error));
else else
fpi_ssm_jump_to_state (transfer->ssm, FPC_CMD_GET_DATA); fpi_ssm_jump_to_state (transfer->ssm, FPC_CMD_GET_DATA);