From e1abeeeec26e0f1109051542a2ad964d786586aa Mon Sep 17 00:00:00 2001 From: Simon Kelley Date: Wed, 16 Mar 2016 17:22:27 +0000 Subject: [PATCH] Fix memory leak in inotify code. --- src/inotify.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/inotify.c b/src/inotify.c index c0a6fdb..603ce9d 100644 --- a/src/inotify.c +++ b/src/inotify.c @@ -54,7 +54,10 @@ static char *my_readlink(char *path) { /* Not link or doesn't exist. */ if (errno == EINVAL || errno == ENOENT) - return NULL; + { + free(buf); + return NULL; + } else die(_("cannot access path %s: %s"), path, EC_MISC); } @@ -200,6 +203,8 @@ void set_dynamic_inotify(int flag, int total_size, struct crec **rhash, int revh free(path); } } + + closedir(dir_stream); } }