[clang] [clang][analyzer] Change default value of checker option in unix.StdCLibraryFunctions. (PR #80457)

Balázs Kéri via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 13 07:35:30 PST 2024


balazske wrote:

> * a [straightforward leak of a string returned by `strdup()`](https://codechecker-demo.eastus.cloudapp.azure.com/Default/report-detail?run=postgres_REL_13_0_modelposix_defaulton&newcheck=postgres_REL_13_0_modelposix_defaultoff&is-unique=on&diff-type=New&report-id=3467892&report-hash=9278b17f14a2612356e847d5ef5426a0&report-filepath=%2aexec.c) is lost and I don't know why. Perhaps turn this into an unit test to examine what happens?

This may happen because the "controlled environment" analyzer option may be set to `true` (but I did not check it). Without `ModelPOSIX` the `getenv` call can fail or not (it is not modeled), but with `ModelPOSIX` it is modeled by the checker and it is assumed that it can not fail (environment variable exists always). In this case the branch with `strdup` is not executed at all.

https://github.com/llvm/llvm-project/pull/80457


More information about the cfe-commits mailing list