From: Waldemar Kozaczuk <jwkozac...@gmail.com>
Committer: Waldemar Kozaczuk <jwkozac...@gmail.com>
Branch: master

loader: don't leak directory entries when processing init entries

This commit originates from the Spirent fork of OSv -
https://github.com/SpirentOrion/osv/commit/502fa31d631bba073e7bb9bc7ce6623e9159dbdd

Authored-by: "Timmons C. Player" <timmons.pla...@spirent.com>
Reviewed-by: Waldemar Kozaczuk <jwkozac...@gmail.com>
Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>
Message-Id: <20220628140241.97140-1-jwkozac...@gmail.com>

---
diff --git a/loader.cc b/loader.cc
--- a/loader.cc
+++ b/loader.cc
@@ -607,6 +607,7 @@ void* do_main_thread(void *_main_args)
         for (int i = 0; i < count; i++) {
             if (!strcmp(".", namelist[i]->d_name) ||
                     !strcmp("..", namelist[i]->d_name)) {
+                free(namelist[i]);
                 continue;
             }
             std::string fn("/init/");

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/00000000000004f84c05e3407d01%40google.com.

Reply via email to