From bfcde74cf9c82e7880e726a15738f6614e236c62 Mon Sep 17 00:00:00 2001 From: "jy910.yun" Date: Wed, 17 Apr 2013 20:13:54 +0900 Subject: [PATCH] modify the prevent issue to avoid resource leak, add free function. And added return value --- ss_bs.c | 1 + ss_mmc_handler.c | 4 ++-- ss_vibrator.c | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ss_bs.c b/ss_bs.c index d29d1b7..20a2c3e 100644 --- a/ss_bs.c +++ b/ss_bs.c @@ -393,6 +393,7 @@ static int _get_file_count(char *path) } count++; } + closedir(dir); return count; } /* check disk available size */ diff --git a/ss_mmc_handler.c b/ss_mmc_handler.c index 5747875..b6b8ea2 100644 --- a/ss_mmc_handler.c +++ b/ss_mmc_handler.c @@ -627,8 +627,8 @@ static int __mmc_mount_fs(void) if (fd < 0) { PRT_TRACE_ERR("can't open the '%s': %s", buf, strerror(errno)); snprintf(buf, sizeof(buf), "%s%d", MMC_DEV, blk_num); - } - close(fd); + } else + close(fd); switch (inserted_type) { case FS_TYPE_FAT: diff --git a/ss_vibrator.c b/ss_vibrator.c index b97a74b..7e42faa 100644 --- a/ss_vibrator.c +++ b/ss_vibrator.c @@ -46,11 +46,13 @@ static GList *haptic_head; static int add_node(struct haptic_node *node) { haptic_head = g_list_append(haptic_head, node); + return 0; } static int delete_node(struct haptic_node *node) { haptic_head = g_list_remove(haptic_head, node); + return 0; } static struct haptic_node *find_node(int handle) -- 2.7.4