bug-gnulib
[Top][All Lists]
Advanced

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

Re: 回复: lib/fts.c: return when malloc failed


From: Pádraig Brady
Subject: Re: 回复: lib/fts.c: return when malloc failed
Date: Mon, 27 Feb 2023 12:02:16 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Thunderbird/109.0

On 27/02/2023 11:36, ChuanGang Jiang wrote:
I found this by accident and then reproduce it through artificial mem pressure 
test.
And I update the patch as you said.

*lib/fts.c:return when malloc failed in function setup_dir()
---
  lib/fts.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/fts.c b/lib/fts.c
index 78584b2902..c2fa5ee8dc 100644
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -979,7 +979,11 @@ next:   tmp = p;
                          }
                          free_dir(sp);
                          fts_load(sp, p);
-                        setup_dir(sp);
+                        if (! setup_dir(sp)) {
+                                free_dir(sp);
+                                __set_errno (ENOMEM);
+                                return (NULL);
+                        }
                          goto check_for_dir;
                  }


Pushed.
I'll also apply this to the upcoming coreutils release for rm.

thanks,
Pádraig.



reply via email to

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