]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
build-sys: make scanf_cv_alloc_modifier to work [LeakSanitizer]
authorSami Kerola <kerolasa@iki.fi>
Sun, 2 Nov 2014 22:06:15 +0000 (22:06 +0000)
committerKarel Zak <kzak@redhat.com>
Tue, 18 Nov 2014 11:55:41 +0000 (12:55 +0100)
The tests failed with following message in config.log

ERROR: LeakSanitizer: detected memory leaks

Direct leak of 2 byte(s) in 1 object(s) allocated from:
    #0 0x49a40e in realloc (/home/src/util-linux/conftest+0x49a40e)
    #1 0x7fbe48633e69 in __GI__IO_vfscanf (/usr/lib/libc.so.6+0x56e69)
    #2 0x7fbe48649786 in _IO_vsscanf (/usr/lib/libc.so.6+0x6c786)

which knocked out libmount from build, and commands depending on it.

The reason this change makes sense is that AddressSanitizer seems like a
good addition to set of tools that util-linux package can use, when and
if needed.

Reference: https://code.google.com/p/address-sanitizer/wiki/AddressSanitizer
Reviewed-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
configure.ac

index 1336f8d14491120a6bc5bac2ac118e3e52e6f629..b8a6627ced5c36f877f3e0b96d666da8ad5d44b6 100644 (file)
@@ -461,6 +461,7 @@ int main()
        int i;
        char *s;
        i = sscanf("x", $1, &s);
+       free(s);
        if (i == 1)
                return 0;
        return 1;