bug-gnulib
[Top][All Lists]
Advanced

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

Fix memleak in glob.m4


From: Bruno Haible
Subject: Fix memleak in glob.m4
Date: Thu, 21 May 2020 19:42:56 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-177-generic; KDE/5.18.0; x86_64; ; )

Tim Rühsen wrote:
> configure:67322: checking whether glob lists broken symlinks
> SUMMARY: AddressSanitizer: 37 byte(s) leaked in 2 allocation(s).

This patch should fix it.


2020-05-21  Bruno Haible  <address@hidden>

        glob: Avoid wrong configure results with "clang -fsanitize=leak".
        Reported by Tim Rühsen in
        <https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00207.html>.
        * m4/glob.m4 (gl_GLOB): Free allocated memory before returning.

diff --git a/m4/glob.m4 b/m4/glob.m4
index dbd09e8..d4cd03f 100644
--- a/m4/glob.m4
+++ b/m4/glob.m4
@@ -1,4 +1,4 @@
-# glob.m4 serial 23
+# glob.m4 serial 24
 dnl Copyright (C) 2005-2007, 2009-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -47,6 +47,7 @@ char a[_GNU_GLOB_INTERFACE_VERSION == 1 || 
_GNU_GLOB_INTERFACE_VERSION == 2 ? 1
                   [[glob_t found;
                     if (glob ("conf*-globtest", 0, NULL, &found) == 
GLOB_NOMATCH)
                       return 1;
+                    globfree (&found);
                   ]])],
                [gl_cv_glob_lists_symlinks=yes],
                [gl_cv_glob_lists_symlinks=no],




reply via email to

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