Browse Source

fixed the memory leak in dfs_elm.c found by hezlog@gmail.com

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2292 bbd45198-f89e-11dd-88c7-29a3b14d5316
goprife@gmail.com 12 years ago
parent
commit
6864f3a38b
1 changed files with 3 additions and 0 deletions
  1. 3 0
      components/dfs/filesystems/elmfat/dfs_elm.c

+ 3 - 0
components/dfs/filesystems/elmfat/dfs_elm.c

@@ -309,6 +309,9 @@ int dfs_elm_open(struct dfs_fd *file)
 		fd = (FIL *)rt_malloc(sizeof(FIL));
 		if (fd == RT_NULL)
 		{
+#if _VOLUMES > 1
+			rt_free(drivers_fn);
+#endif
 			return -DFS_STATUS_ENOMEM;
 		}