analyzer: handle strdup and strndup
authorDavid Malcolm <dmalcolm@redhat.com>
Wed, 16 Sep 2020 21:21:32 +0000 (17:21 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Fri, 18 Sep 2020 21:38:34 +0000 (17:38 -0400)
commitc89956cba9d1a5fbf059f7880ff49418718a2965
treea4c2d0c4f393dd43f96f9e9060488debff8e2caf
parente1a1808cd19afd93fc4134fbd8376346d05bdba8
analyzer: handle strdup and strndup

gcc/analyzer/ChangeLog:
* sm-malloc.cc (malloc_state_machine::on_stmt): Handle strdup and
strndup as being malloc-like allocators.

gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/strdup-1.c: New test.
* gcc.dg/analyzer/strndup-1.c: New test.
gcc/analyzer/sm-malloc.cc
gcc/testsuite/gcc.dg/analyzer/strdup-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/analyzer/strndup-1.c [new file with mode: 0644]