Re: [PATCH 1/4] tools/csr_usb : Fix Resource leak: file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Wed, Oct 15, 2014 at 5:08 PM, Gowtham Anandha Babu
<gowtham.ab@xxxxxxxxxxx> wrote:
> Handles resource leak.
> ---
>  tools/csr_usb.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/tools/csr_usb.c b/tools/csr_usb.c
> index 5fb6bdc..a1d7324 100644
> --- a/tools/csr_usb.c
> +++ b/tools/csr_usb.c
> @@ -80,9 +80,12 @@ static int read_value(const char *name, const char *attr, const char *format)
>                 return -1;
>
>         n = fscanf(file, format, &value);
> -       if (n != 1)
> +       if (n != 1) {
> +               fclose(file);
>                 return -1;
> +       }
>
> +       fclose(file);
>         return value;
>  }
>
> --
> 1.9.1

Applied 1-3, but note that I did some changes in the commit message,
please be consistent and don't include things like space before ':'
etc, it is always a good practice got look how previous commit have
been formatted and follow the HACKING document.


-- 
Luiz Augusto von Dentz
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux