Parent: 3652e98d2bb6fe8d7ba5b66f9cd6403fca3995b7
Author: Bastien Nocera <hadess@hadess.net>
Committer: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: 2024-05-10 18:28:14
Tree: ae23e868a766bf1f8fd746bd2fc2f96d6b4b54dd
main: Fix memory leaks Error: RESOURCE_LEAK (CWE-772): [#def51] [important] src/main.c:451:2: alloc_arg: "parse_config_string" allocates memory that is stored into "str". src/main.c:454:2: identity_transfer: Passing "str" as argument 1 to function "strtol", which sets "endptr" to that argument. src/main.c:456:3: noescape: Assuming resource "str" is not freed or pointed-to as ellipsis argument to "btd_error". src/main.c:457:3: leaked_storage: Variable "endptr" going out of scope leaks the storage it points to. src/main.c:457:3: leaked_storage: Variable "str" going out of scope leaks the storage it points to. 455| if (!endptr || *endptr != '\0') { 456| error("%s.%s = %s is not integer", group, key, str); 457|-> return false; 458| } 459| Error: RESOURCE_LEAK (CWE-772): [#def52] [important] src/main.c:451:2: alloc_arg: "parse_config_string" allocates memory that is stored into "str". src/main.c:454:2: identity_transfer: Passing "str" as argument 1 to function "strtol", which sets "endptr" to that argument. src/main.c:463:3: leaked_storage: Variable "endptr" going out of scope leaks the storage it points to. src/main.c:463:3: leaked_storage: Variable "str" going out of scope leaks the storage it points to. 461| warn("%s.%s = %zu is out of range (< %zu)", group, key, tmp, 462| min); 463|-> return false; 464| } 465| Error: RESOURCE_LEAK (CWE-772): [#def53] [important] src/main.c:451:2: alloc_arg: "parse_config_string" allocates memory that is stored into "str". src/main.c:454:2: identity_transfer: Passing "str" as argument 1 to function "strtol", which sets "endptr" to that argument. src/main.c:475:2: leaked_storage: Variable "endptr" going out of scope leaks the storage it points to. src/main.c:475:2: leaked_storage: Variable "str" going out of scope leaks the storage it points to. 473| *val = tmp; 474| 475|-> return true; 476| } 477|
Diffstat
| M | src/main.c | | | 4 | ++++ |
1 files changed, 4 insertions(+), 0 deletions(-)