From 6a2098d35c1380e75e911db62d548a16b2455dcd Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 10 Oct 2015 18:01:14 -0600 Subject: [PATCH] TMPFS: Fix a memory leak --- fs/tmpfs/fs_tmpfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/tmpfs/fs_tmpfs.c b/fs/tmpfs/fs_tmpfs.c index 4c2b78ef4b4..f1b62e69760 100644 --- a/fs/tmpfs/fs_tmpfs.c +++ b/fs/tmpfs/fs_tmpfs.c @@ -974,6 +974,7 @@ static int tmpfs_find_object(FAR struct tmpfs_s *fs, { /* No object with this name exists in the directory. */ + kmm_free(copy); return index; } @@ -993,10 +994,11 @@ static int tmpfs_find_object(FAR struct tmpfs_s *fs, } /* No, this was not the final segement of the relpath. - * We cannot continue the search if any of the intermidate - * segements do no correspond to directories. + * We cannot continue the search if any of the intermediate + * segments do no correspond to directories. */ + kmm_free(copy); return -ENOTDIR; }