[make-initrd] [PATCH 1/2] ueventd: Fix memory leak

Alexey Gladkov gladkov.alexey at gmail.com
Mon May 22 10:57:22 MSK 2023


Fixes: 31cbad99 ("Reimplement ueventd")
Signed-off-by: Alexey Gladkov <gladkov.alexey at gmail.com>
---
 datasrc/ueventd/ueventd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/datasrc/ueventd/ueventd.c b/datasrc/ueventd/ueventd.c
index afe050d0..c2c23ba3 100644
--- a/datasrc/ueventd/ueventd.c
+++ b/datasrc/ueventd/ueventd.c
@@ -104,8 +104,10 @@ int watch_path(int inotifyfd, const char *dir, const char *name, uint32_t mask,
 	rd_asprintf_or_die(&path, "%s/%s", dir, name);
 
 	int wfd = add_queue_dir(inotifyfd, path, mask);
-	if (wfd < 0)
+	if (wfd < 0) {
+		free(path);
 		return (wfd == -128 ? 0 : wfd);
+	}
 
 	if (stat(path, &st) < 0) {
 		rd_err("stat: %s: %m", path);
-- 
2.33.8



More information about the Make-initrd mailing list