https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99004

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:e5304598f1481886f9871cc024cb65ba34aa4be3

commit r11-7145-ge5304598f1481886f9871cc024cb65ba34aa4be3
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Tue Feb 9 12:29:32 2021 +0100

    calls: Fix a memory leak in maybe_warn_rdwr_sizes [PR99004]

    The print_generic_expr_to_str function ends with
    return xstrdup (...); and therefore expects the caller to free
    the argument.

    The following patch does that after it has been copied.
    Instead of doing const_cast to cast away const char * to char *,
    because the code uses s0 and s1 in so few places, I chose just
    to change the types of the two variables so that const_cast
    is not needed.  After all, it is a heap allocated string that
    this function owns and so if it wanted, it could change it too.

    2021-02-09  Jakub Jelinek  <ja...@redhat.com>

            PR middle-end/99004
            * calls.c (maybe_warn_rdwr_sizes): Change s0 and s1 type from
            const char * to char * and free those pointers after use.

Reply via email to