Message ID | 1367878015-18122-1-git-send-email-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
On 05/07/2013 06:06 AM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > Coverity CID #997348, Resource leak. > > Need to close fd before we return. > > Signed-off-by: Colin Ian King <colin.king@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@canonical.com>
On 05/07/2013 06:06 AM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > Coverity CID #997348, Resource leak. > > Need to close fd before we return. > > Signed-off-by: Colin Ian King <colin.king@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: Ivan Hu <ivan.hu@canonical.com>
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);