ACK: [PATCH] hotkey: close fd on error
Alex Hung
alex.hung at canonical.com
Tue May 7 03:40:40 UTC 2013
On 05/07/2013 06:06 AM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Coverity CID #997348, Resource leak.
>
> Need to close fd before we return.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/hotkey/hotkey/hotkey.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/src/hotkey/hotkey/hotkey.c b/src/hotkey/hotkey/hotkey.c
> index 38be7b0..ff3c669 100644
> --- a/src/hotkey/hotkey/hotkey.c
> +++ b/src/hotkey/hotkey/hotkey.c
> @@ -84,6 +84,7 @@ static int hotkey_test(fwts_framework *fw, char *dev, fwts_list *hotkeys)
>
> if (ioctl(fd, EVIOCGRAB, (void*)1)) { /* Get focus */
> fwts_log_error(fw, "Cannot grab device %s.", path);
> + close(fd);
> return FWTS_ERROR;
> }
>
> @@ -106,6 +107,7 @@ static int hotkey_test(fwts_framework *fw, char *dev, fwts_list *hotkeys)
>
> if (ioctl(fd, EVIOCGRAB, (void*)0)) { /* Release */
> fwts_log_error(fw, "Cannot un-grab device %s.", path);
> + close(fd);
> return FWTS_ERROR;
> }
> close(fd);
>
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list