From 893829021bd50604b035c058814f280c7386aa46 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sat, 13 Jan 2024 10:20:41 +0100 Subject: [PATCH] Fix NULL dereference in w32notify.c * src/w32notify.c (start_watching): Return NULL instead of freed pointer. (add_watch): Fix NULL dereference. --- src/w32notify.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/w32notify.c b/src/w32notify.c index 9f8a62a1daa..c93e8796fe2 100644 --- a/src/w32notify.c +++ b/src/w32notify.c @@ -350,6 +350,7 @@ start_watching (const char *file, HANDLE hdir, BOOL subdirs, DWORD flags) xfree (dirwatch->io_info); xfree (dirwatch->watchee); xfree (dirwatch); + return NULL; } return dirwatch; } @@ -412,10 +413,7 @@ add_watch (const char *parent_dir, const char *file, BOOL subdirs, DWORD flags) return NULL; if ((dirwatch = start_watching (file, hdir, subdirs, flags)) == NULL) - { - CloseHandle (hdir); - dirwatch->dir = NULL; - } + CloseHandle (hdir); return dirwatch; } -- 2.39.2