]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
glob: Fix a memory leak.
authorBruno Haible <bruno@clisp.org>
Tue, 21 Oct 2025 07:40:46 +0000 (09:40 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 21 Oct 2025 07:40:46 +0000 (09:40 +0200)
Found by Coverity.

* lib/glob.c (__glob): Add scratch_buffer_free invocation, to match
scratch_buffer_init invocation.

ChangeLog
lib/glob.c

index 959300b1ca1e549a28a53b8d5b2c8e369b1356e5..ad5c702e990d18fce0d2730248d66c4b9ac68830 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-10-21  Bruno Haible  <bruno@clisp.org>
+
+       glob: Fix a memory leak.
+       Found by Coverity.
+       * lib/glob.c (__glob): Add scratch_buffer_free invocation, to match
+       scratch_buffer_init invocation.
+
 2025-10-20  Bruno Haible  <bruno@clisp.org>
 
        glob: Add support for Android.
index 48f10ae0e1a4e4a2166e302cad1d731404cc5177..dc21014afffba428d5d5dc466f729a1caa7aa621 100644 (file)
@@ -872,6 +872,7 @@ __glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
                   {
                     /* We have to regard it as an error if we cannot find the
                        home directory.  */
+                    scratch_buffer_free (&pwtmpbuf);
                     retval = GLOB_NOMATCH;
                     goto out;
                   }