[PATCH 1/3] ui/common: Only close valid file descriptor
Sam Mendoza-Jonas
sam at mendozajonas.com
Tue Feb 9 13:08:43 AEDT 2016
From: Samuel Mendoza-Jonas <sam.mj at au1.ibm.com>
Fixes Coverity defect #30466
Signed-off-by: Sam Mendoza-Jonas <sam at mendozajonas.com>
---
ui/common/joystick.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ui/common/joystick.c b/ui/common/joystick.c
index 455ff19..a3d6abd 100644
--- a/ui/common/joystick.c
+++ b/ui/common/joystick.c
@@ -98,8 +98,8 @@ struct pjs *pjs_init(void *ctx, int (*map)(const struct js_event *))
return pjs;
out_err:
- close(pjs->fd);
- pjs->fd = 0;
+ if (pjs->fd >= 0)
+ close(pjs->fd);
talloc_free(pjs);
return NULL;
}
--
2.7.1
More information about the Petitboot
mailing list