aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-switch-conversion.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2021-02-09 12:29:32 +0100
committerJakub Jelinek <jakub@redhat.com>2021-02-09 12:29:32 +0100
commite5304598f1481886f9871cc024cb65ba34aa4be3 (patch)
treee97fdc96192c579e5526c77fd96b726d5c6cc014 /gcc/tree-switch-conversion.c
parent283653f45595f53db486cbc2f1f10091cb45ea3b (diff)
downloadgcc-e5304598f1481886f9871cc024cb65ba34aa4be3.zip
gcc-e5304598f1481886f9871cc024cb65ba34aa4be3.tar.gz
gcc-e5304598f1481886f9871cc024cb65ba34aa4be3.tar.bz2
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 <jakub@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.
Diffstat (limited to 'gcc/tree-switch-conversion.c')
0 files changed, 0 insertions, 0 deletions