Fix potential memory leakage
authorTaeJun Kwon <tj80.kwon@samsung.com>
Mon, 3 Apr 2017 08:30:17 +0000 (17:30 +0900)
committerTaeJun Kwon <tj80.kwon@samsung.com>
Mon, 3 Apr 2017 08:30:17 +0000 (17:30 +0900)
There are potential memory leakage in rmdir & unlink in smartfs

os/fs/smartfs/smartfs_smart.c

index a42686c..49c7d9e 100644 (file)
@@ -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;
 }