ACK: [PATCH] lib: fwts_keymap: free keymap_list on error
Alex Hung
alex.hung at canonical.com
Tue May 7 03:29:31 UTC 2013
On 05/07/2013 05:59 AM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Coverity CID #997344, Resource leak.
>
> Need to free keymap_list before we return
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/lib/src/fwts_keymap.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/lib/src/fwts_keymap.c b/src/lib/src/fwts_keymap.c
> index 71800fc..646cdfa 100644
> --- a/src/lib/src/fwts_keymap.c
> +++ b/src/lib/src/fwts_keymap.c
> @@ -62,8 +62,10 @@ fwts_list *fwts_keymap_load(const char *machine)
>
> snprintf(path, sizeof(path), "%s/%s", FWTS_KEYMAP_PATH, machine);
>
> - if ((fp = fopen(path, "r")) == NULL)
> + if ((fp = fopen(path, "r")) == NULL) {
> + fwts_keymap_free(keymap_list);
> return NULL;
> + }
>
> while (fgets(buffer, sizeof(buffer), fp) != NULL) {
> fwts_keycode *key;
>
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list