aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/class.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2021-05-18 12:29:58 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2021-05-18 12:29:58 -0400
commitcd323d97d0592135ca4345701ef051659d8d4507 (patch)
treebeceb65d66cbe4f39fbd7c287ed5de89a8bbea8c /gcc/cp/class.c
parent46ca31d65092e5afcef292f807fcf14c5363280d (diff)
downloadgcc-cd323d97d0592135ca4345701ef051659d8d4507.zip
gcc-cd323d97d0592135ca4345701ef051659d8d4507.tar.gz
gcc-cd323d97d0592135ca4345701ef051659d8d4507.tar.bz2
analyzer: fix missing leak after call to strsep [PR100615]
PR analyzer/100615 reports a missing leak diagnostic. The issue is that the code calls strsep which the analyzer doesn't have special knowledge of, and so conservatively assumes that it could free the pointer, so drops malloc state for it. Properly "teaching" the analyzer about strsep would require it to support bifurcating state at a call, which is currently fiddly to do, so for now this patch notes that strsep doesn't affect the malloc state machine, allowing the analyzer to correctly detect the leak. gcc/analyzer/ChangeLog: PR analyzer/100615 * sm-malloc.cc: Include "analyzer/function-set.h". (malloc_state_machine::on_stmt): Call unaffected_by_call_p and bail on the functions it recognizes. (malloc_state_machine::unaffected_by_call_p): New. gcc/testsuite/ChangeLog: PR analyzer/100615 * gcc.dg/analyzer/pr100615.c: New test.
Diffstat (limited to 'gcc/cp/class.c')
0 files changed, 0 insertions, 0 deletions