From: Stefan Kangas Date: Sat, 13 Jan 2024 09:20:41 +0000 (+0100) Subject: Fix NULL dereference in w32notify.c X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=893829021bd50604b035c058814f280c7386aa46;p=emacs.git Fix NULL dereference in w32notify.c * src/w32notify.c (start_watching): Return NULL instead of freed pointer. (add_watch): Fix NULL dereference. --- 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; }