]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
posix: Fix memory leak a memory leak in glob.
authorBruno Haible <bruno@clisp.org>
Wed, 22 Oct 2025 02:06:05 +0000 (19:06 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Wed, 22 Oct 2025 02:09:45 +0000 (19:09 -0700)
Found by Coverity in Gnulib.

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

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
posix/glob.c

index 0c86d26972e929779700ce52571cbebcb0f3776d..846528e252658c9fa1e06980a0c6f8f2e2e77499 100644 (file)
@@ -886,6 +886,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;
                   }