GNU bug report logs - #19578
Memory leaks in coreutils/lib/locale_charset.c

Previous Next

Package: coreutils;

Reported by: Zhaopeng Li <zpli <at> ustc.edu.cn>

Date: Tue, 13 Jan 2015 05:49:02 UTC

Severity: normal

Tags: notabug

Merged with 19580

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Daiki Ueno <ueno <at> gnu.org>
To: Zhaopeng Li <zpli <at> ustc.edu.cn>
Cc: 19578 <at> debbugs.gnu.org
Subject: bug#19578: Memory leaks in coreutils/lib/locale_charset.c
Date: Tue, 13 Jan 2015 18:35:05 +0900
Zhaopeng Li <zpli <at> ustc.edu.cn> writes:

> At line 534 of coreutils/lib/locale_charset.c, var ‘aliases' points
> to a buffer which is allocated using malloc() .

> This buffer is not freed when codeset is still an empty string after
> the loop (Line 534~542).
>
> So it will be leaked under such situation.

> Line 533    /* Resolve alias. */
> Line 534   for (aliases = get_charset_aliases ();

I got the same error from clang-analyzer, but I think the leak is
intentional and harmless.  The return value of get_charset_aliases is
saved in a global variable charset_aliases and won't be allocated twice.

Regards,
--
Daiki Ueno




This bug report was last modified 10 years and 137 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.