From 07fbc5b6d50e200428448cbcb339846c8afee792 Mon Sep 17 00:00:00 2001 From: "jy910.yun" Date: Fri, 5 Apr 2013 14:59:49 +0900 Subject: [PATCH] resolve prevent issue about resource leak of file description Change-Id: I174c6dd5fb90cf32b51de86bcd08ca2c75a7ebd0 --- tizen/DEVICE/src/haptic.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tizen/DEVICE/src/haptic.c b/tizen/DEVICE/src/haptic.c index 688e61e..e80341b 100644 --- a/tizen/DEVICE/src/haptic.c +++ b/tizen/DEVICE/src/haptic.c @@ -186,18 +186,21 @@ static int __save_file(const unsigned char *vibe_buferf, int size, const char *f status = fwrite(vibe_buferf, 1, size, pf); if (status != size) { MODULE_ERROR("To write file is failed"); + fclose(pf); return HAPTIC_MODULE_OPERATION_FAILED; } fd = fileno(pf); if (fd == -1) { MODULE_ERROR("To get file descriptor is failed"); + fclose(pf); return HAPTIC_MODULE_OPERATION_FAILED; } status = fsync(fd); if (status == -1) { MODULE_ERROR("To be synchronized with the disk is failed"); + fclose(pf); return HAPTIC_MODULE_OPERATION_FAILED; } -- 2.7.4