platform/surface: aggregator: Add missing call to ssam_request_sync_free()
authorMaximilian Luz <luzmaximilian@gmail.com>
Tue, 20 Dec 2022 17:56:07 +0000 (18:56 +0100)
committerHans de Goede <hdegoede@redhat.com>
Thu, 12 Jan 2023 18:12:02 +0000 (19:12 +0100)
Although rare, ssam_request_sync_init() can fail. In that case, the
request should be freed via ssam_request_sync_free(). Currently it is
leaked instead. Fix this.

Fixes: c167b9c7e3d6 ("platform/surface: Add Surface Aggregator subsystem")
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Link: https://lore.kernel.org/r/20221220175608.1436273-1-luzmaximilian@gmail.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/surface/aggregator/controller.c

index 43e7651991371b5ea292d0d379f8dcfd72dfeab4..c6537a1b3a2ec13ac2f32f7f82f87d7406cb53cb 100644 (file)
@@ -1700,8 +1700,10 @@ int ssam_request_sync(struct ssam_controller *ctrl,
                return status;
 
        status = ssam_request_sync_init(rqst, spec->flags);
-       if (status)
+       if (status) {
+               ssam_request_sync_free(rqst);
                return status;
+       }
 
        ssam_request_sync_set_resp(rqst, rsp);