From 3165535f41ea9c879a983b6e80fda0152712b602 Mon Sep 17 00:00:00 2001 From: TaeJun Kwon Date: Mon, 3 Apr 2017 17:30:17 +0900 Subject: [PATCH] Fix potential memory leakage There are potential memory leakage in rmdir & unlink in smartfs --- os/fs/smartfs/smartfs_smart.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/os/fs/smartfs/smartfs_smart.c b/os/fs/smartfs/smartfs_smart.c index a42686c..49c7d9e 100644 --- a/os/fs/smartfs/smartfs_smart.c +++ b/os/fs/smartfs/smartfs_smart.c @@ -1680,6 +1680,9 @@ static int smartfs_unlink(struct inode *mountpt, const char *relpath) ret = OK; errout_with_semaphore: + if (entry.name != NULL) { + kmm_free(entry.name); + } smartfs_semgive(fs); return ret; } @@ -1862,6 +1865,9 @@ int smartfs_rmdir(struct inode *mountpt, const char *relpath) ret = OK; errout_with_semaphore: + if (entry.name != NULL) { + kmm_free(entry.name); + } smartfs_semgive(fs); return ret; } -- 2.7.4