From: jy910.yun Date: Fri, 5 Apr 2013 05:59:49 +0000 (+0900) Subject: resolve prevent issue about resource leak of file description X-Git-Tag: 2.1b_release~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=07fbc5b6d50e200428448cbcb339846c8afee792;hp=65067f3f5b43a8444748879036e2e3fe1bc1bf75;p=platform%2Fcore%2Fsystem%2Fhaptic-module-tizen.git resolve prevent issue about resource leak of file description Change-Id: I174c6dd5fb90cf32b51de86bcd08ca2c75a7ebd0 --- 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; }