emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 893829021bd 2/2: Fix NULL dereference in w32notify.c


From: Stefan Kangas
Subject: master 893829021bd 2/2: Fix NULL dereference in w32notify.c
Date: Sat, 13 Jan 2024 04:25:24 -0500 (EST)

branch: master
commit 893829021bd50604b035c058814f280c7386aa46
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

    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;
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]