{ "tokens": { "input": 138557, "cache_read": 321068, "cache_write": 43782, "output": 11731 }, "reviews": [ { "key": [ "https://ftp.debian.org/debian/pool/main/c/criu/criu_4.3.orig.tar.xz", "main criu-4.3/criu/action-scripts.c:180:2: error: Memory leak: script [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`script` is malloc'd and linked into the global `scripts` list via `list_add(&script->node, &scripts)`. That is the classic embedded list_head pattern, so ownership moves to the global list and nothing leaks. The PR now treats passing the address of an embedded member of the allocation as a use of the owner pointer, which removes this false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/criu/criu_4.3.orig.tar.xz", "main criu-4.3/criu/autofs.c:58:2: error: Memory leak: pipe [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "autofs_gather_pipe() allocates `pipe` and links it into the global list via list_add_tail(&pipe->list, &autofs_pipes). The global list keeps the allocation, so there is no leak and the main warning was a false positive. The PR treats passing the address of an embedded member to an unknown function as a possible use of the owner, which removes this FP. It is the same pattern as the #6259 test case." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/criu/criu_4.3.orig.tar.xz", "main criu-4.3/criu/shmem.c:387:2: error: Memory leak: att [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "In the first branch, `att` is allocated and then linked into `si->att` with `list_add(&att->l, &si->att)`. The embedded `l` member is passed by address, so the list now references the allocation and owns it. The memleak at the return was a false positive. The PR treats passing `&ptr->member` to a non-ignored function as a use of `ptr`, which removes this false positive correctly." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/criu/criu_4.3.orig.tar.xz", "main criu-4.3/criu/tun.c:134:2: error: Memory leak: tl [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`list_tun_link` allocates `tl` and then calls `list_add_tail(&tl->l, &tun_links)`. That links the embedded list node into the global `tun_links` list, so the allocation is still reachable through the list and is not leaked. The PR treats passing the address of a member of an allocated struct to a non-ignored function as a use of the owner pointer. That removes this false memleak, which is the exact intrusive-list pattern from #6259." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/criu/criu_4.3.orig.tar.xz", "main criu-4.3/plugins/amdgpu/amdgpu_plugin_dmabuf.c:173:3: error: Memory leak: b [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The allocated `b` is linked into the global `dmabuf_list` via `list_add(&b->node, &dmabuf_list)`, which is an intrusive list. Later, `try_dump_dmabuf_list` walks that list and frees the entries. Ownership is therefore transferred, so the memleak warning was a false positive. The PR treats passing the address of an embedded member to a function as a use of the owner, which removes it." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/criu/criu_4.3.orig.tar.xz", "main criu-4.3/plugins/amdgpu/amdgpu_plugin_util.c:164:2: error: Memory leak: work [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`work` is malloc'd and its embedded list node `&work->l` is passed to `list_add()`, which links it into the global `completed_work` list. `clear_restore_state()` later frees these entries through that list, so the memory is not leaked. The old memleak report was a false positive, and the PR removes it by treating the passed member address as a use of `work`." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/criu/criu_4.3.orig.tar.xz", "main criu-4.3/plugins/amdgpu/amdgpu_plugin_util.c:67:2: error: Memory leak: st [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`st` is allocated, and then `list_add(&st->l, &dumped_fds)` links its embedded list node into a global list. The memory stays reachable through that list, which is the classic intrusive-list pattern from #6259, so it is not leaked. The PR now treats passing the address of an embedded member to a non-leak-ignore function as a use of the owner, which removes this false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/criu/criu_4.3.orig.tar.xz", "main criu-4.3/plugins/cuda/cuda_plugin_cli.c:101:2: error: Memory leak: new [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`new` is allocated with xmalloc. Its embedded member `&new->list` is then linked into `pid_buf` by `list_add_tail`. After that the memory is reachable through the list, and `dealloc_pid_buffer` frees it later. So the memleak warning was a false positive. The PR now treats passing the address of an embedded member to a function as a use of the owner pointer, which removes this false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/criu/criu_4.3.orig.tar.xz", "main criu-4.3/plugins/cuda/cuda_plugin_driver.c:112:2: error: Memory leak: info [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`info` is allocated and then added to the global `cuda_pids` list with `list_add_tail(&info->list, &cuda_pids)`. The embedded list node points into the allocation, so the list now owns the memory and `free_cuda_pid_list()` frees it later. The old memleak report was a false positive. The PR treats passing the address of an embedded member as a use of the owning pointer, which removes it correctly." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/criu/criu_4.3.orig.tar.xz", "main criu-4.3/test/zdtm/transition/maps007.c:69:3: error: Memory leak: shm [memleak]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "`shm` is mmap'd at line 49 and never munmap'd. The early `return 1` at line 69 leaves the mapping in place, so main's warning was technically a true positive, though harmless because it is in main. The PR now treats `futex_set(&shm->delta, v)` as a possible ownership transfer because a member address is passed to a function it does not know. `futex_set` only stores a value into the futex and does not keep the pointer. The removed warning is therefore a new false negative caused by the conservative heuristic." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/fbi/fbi_2.14.orig.tar.gz", "main fbida-2.14/desktop.c:191:5: error: Memory leak: add [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`add_line` mallocs `add` and links it into the list with `list_add_tail(&add->next, file)`. That call stores the address of the embedded list node, which is the standard intrusive linked-list pattern. The allocation is still reachable through the list, so the memleak report was a false positive. The PR now treats passing the address of an embedded member as a possible use of the owner pointer, which removes this warning." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/fbi/fbi_2.14.orig.tar.gz", "main fbida-2.14/fileops.c:101:1: error: Memory leak: job [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`job` is malloc'd and then linked into the global `jobs` list via `list_add_tail(&job->list,&jobs)`. That hands ownership to the list, and `job_worker` later frees it. So the memleak at the end of `job_submit` was a false positive. The PR treats passing the address of an embedded member of the allocation to an unknown function as a use, which removes this false positive. This is exactly the #6259 pattern covered by the PR's tests." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/fbi/fbi_2.14.orig.tar.gz", "main fbida-2.14/rd/read-jpeg.c:94:2: error: Memory leak: h [memleak]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "`h` is malloc'd, and when `setjmp(h->errjump)` returns non-zero the function does `return 0;` without freeing `h`, so the leak at line 94 is real. The only place `h` escapes is `jpeg_std_error(&h->jerr)`. That function returns its argument, and the result is stored in `h->cinfo.err`, inside the same allocation, so ownership never leaves the function. The PR treats passing `&h->jerr` to an unconfigured function as a possible use of `h`, which suppresses this true positive. That is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/k/ksh93u+m/ksh93u+m_1.0.10.orig.tar.gz", "main ksh-1.0.10/src/lib/libast/disc/sfdcmore.c:311:4: error: Memory leak: more [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`more` is malloc'd and its embedded member is registered with `sfdisc(f, &more->disc)`, which hands ownership to the stream. On the error path at line 311, `sfdisc(f, SFIO_POPDISC)` pops the discipline, and sfio's `moreexcept` handler frees the More_t on pop/final. So the memory is not leaked, and line 311 is reachable only after that registration. The PR now treats passing the address of an embedded member as a possible use of the owner, which removes this false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/k/ksh93u+m/ksh93u+m_1.0.10.orig.tar.gz", "main ksh-1.0.10/src/lib/libast/disc/sfdcmore.c:317:4: error: Memory leak: more [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "At line 301, `sfdisc(f, &more->disc)` passes the address of an embedded member of the malloc'd `more` to a function that keeps it, so the stream now references the allocation. The discipline's exceptf (moreexcept) presumably frees it when the discipline is popped. At line 317, `sfdisc(f, SFIO_POPDISC)` is called before returning, so ownership was handed to the sfio machinery and the reported leak is a false positive. The PR treats `&more->disc` passed to a non-ignored function as a possible use, which removes this false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/k/ksh93u+m/ksh93u+m_1.0.10.orig.tar.gz", "main ksh-1.0.10/src/lib/libast/disc/sfdcmore.c:322:2: error: Memory leak: more [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "At line 301 the code passes `&more->disc` to `sfdisc(f, ...)`. This installs the embedded discipline on the stream, so the stream now holds a pointer into the allocation and ownership has effectively moved to it (the discipline's exceptf typically frees it). The function then returns 0 without freeing `more`, which is intentional, so the memleak report at line 322 was a false positive. The PR now treats passing the address of an embedded member as a use of the owner, which removes this false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcypher-parser/libcypher-parser_0.6.2.orig.tar.gz", "main libcypher-parser-0.6.2/lib/src/ast_all_rels_scan.c:62:5: error: Memory leak: node [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The function allocates `node` with calloc and passes `&(node->_astnode)` to `cypher_astnode_init`. It then returns `&(node->_astnode)`, which points to the first member and therefore to the same storage. The caller owns that pointer and frees it later through `container_of`. So the allocation is not leaked, and the memleak report was a false positive. The PR treats passing a member's address to a function as a possible use of the owning pointer, which removes this false warning." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcypher-parser/libcypher-parser_0.6.2.orig.tar.gz", "main libcypher-parser-0.6.2/lib/src/ast_any.c:84:5: error: Memory leak: node [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The function allocates `node` and passes `&(node->_list_comprehension_astnode)`, the address of an embedded member, to an init function. It then returns `&(node->_list_comprehension_astnode._astnode)`, a pointer into the allocation, so the memory is not leaked; callers later recover `node` with `container_of`. The old memleak warning at the return was a false positive. The PR now treats passing the address of an embedded member to a non-ignored function as a use of the owner, so the warning goes away correctly." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcypher-parser/libcypher-parser_0.6.2.orig.tar.gz", "main libcypher-parser-0.6.2/lib/src/ast_binary_operator.c:70:5: error: Memory leak: node [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The function returns &(node->_astnode), the address of an embedded member of the allocated node, so the allocation escapes to the caller (and container_of is used to recover it later). The memleak warning was a false positive. The PR treats passing &node->_astnode to cypher_astnode_init as a possible use, and that suppresses this warning." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcypher-parser/libcypher-parser_0.6.2.orig.tar.gz", "main libcypher-parser-0.6.2/lib/src/ast_create_node_prop_constraint.c:72:5: error: Memory leak: node [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The function callocs `node`, passes `&(node->_astnode)` (an embedded struct member) to `cypher_astnode_init`, and then returns `&(node->_astnode)`. The getters recover the allocation with `container_of`, so ownership is handed to the caller and nothing leaks. The PR treats passing the address of an embedded member of the allocation to a function as possible use. That removes this false memleak report, which matches the same pattern removed across all the other ast_*.c files." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcypher-parser/libcypher-parser_0.6.2.orig.tar.gz", "main libcypher-parser-0.6.2/lib/src/ast_explain_option.c:58:5: error: Memory leak: node [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The function callocs `node` and on success returns `&(node->_astnode)`, which is the address of the first member. Ownership of the allocation passes to the caller, and on the failure path `node` is freed. So the memleak report at line 58 was a false positive. The PR treats passing `&(node->_astnode)` to the non-library function `cypher_astnode_init` as a possible use of `node`, which suppresses the warning. Removing this false positive is an improvement." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcypher-parser/libcypher-parser_0.6.2.orig.tar.gz", "main libcypher-parser-0.6.2/lib/src/ast_extract.c:84:5: error: Memory leak: node [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`node` is calloc'ed and `&(node->_list_comprehension_astnode)` is passed to an init function. The function then returns the address of an embedded member, `&(node->_list_comprehension_astnode._astnode)`. The library later recovers `node` from that member pointer with container_of and frees it through the vtable. So the memory is not leaked, and the memleak report was a false positive. The PR treats passing the address of an embedded member to a non-ignored function as possible use, which removes this false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcypher-parser/libcypher-parser_0.6.2.orig.tar.gz", "main libcypher-parser-0.6.2/lib/src/ast_false.c:57:5: error: Memory leak: node [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The function allocates `node` and returns `&(node->_astnode)`. `_astnode` is the first member, so the returned pointer is the allocation itself and ownership passes to the caller. There is no leak, so main's memleak report was a false positive. The PR now treats passing `&(node->_astnode)` to the unconfigured function `cypher_astnode_init` as a possible use of `node`, which suppresses this false report. The same pattern explains all the other removed warnings in this package." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcypher-parser/libcypher-parser_0.6.2.orig.tar.gz", "main libcypher-parser-0.6.2/lib/src/ast_identifier.c:60:5: error: Memory leak: node [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The function returns `&(node->_astnode)`. `_astnode` is the first embedded member of the struct allocated with calloc, so the returned pointer is the start of the same allocation. Callers later recover the full struct with container_of and free it through the vtable. The memory is not leaked, so main's 'Memory leak: node' was a false positive. The PR marks `node` as used when the address of an embedded member is passed to `cypher_astnode_init(&(node->_astnode), ...)`, which removes this warning. Removing it is correct." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcypher-parser/libcypher-parser_0.6.2.orig.tar.gz", "main libcypher-parser-0.6.2/lib/src/ast_index_name.c:55:5: error: Memory leak: node [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The function allocates `node`, passes `&(node->_astnode)` to `cypher_astnode_init`, and returns `&(node->_astnode)`. `_astnode` is the first member, so the caller gets the allocation back and frees it through the vtable. There is no leak, so main's memleak warning was a false positive. The PR treats passing the address of an embedded member to a non-ignored function as a possible use of `node`, which removes this false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcypher-parser/libcypher-parser_0.6.2.orig.tar.gz", "main libcypher-parser-0.6.2/lib/src/ast_map_projection.c:70:5: error: Memory leak: node [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The function allocates `node` with calloc and returns `&(node->_astnode)`, the address of an embedded member. The caller later recovers `node` with `container_of` and frees it, so the memory does not leak. The PR treats passing `&(node->_astnode)` to `cypher_astnode_init` as a possible use or retention of `node`, which removes the false memleak report at the return. Strictly speaking, returning the member address is what really transfers ownership here. Either way, the removed warning was a false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcypher-parser/libcypher-parser_0.6.2.orig.tar.gz", "main libcypher-parser-0.6.2/lib/src/ast_merge_properties.c:66:5: error: Memory leak: node [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The function returns &(node->_astnode), a pointer to an embedded member of the allocated struct. The caller frees it later through container_of, so ownership passes to the caller and nothing leaks. Main reported the leak at the return statement, which was a false positive. The PR marks the owner as used when the address of an embedded member is passed to cypher_astnode_init(&(node->_astnode), ...), and that removes this false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcypher-parser/libcypher-parser_0.6.2.orig.tar.gz", "main libcypher-parser-0.6.2/lib/src/ast_named_path.c:72:5: error: Memory leak: node [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The function callocs `node` and returns `&(node->_pattern_path_astnode._astnode)`. That is a pointer into the same allocation, which is later recovered with `container_of` and freed, so the memory is not leaked. The old memleak report was a false positive. The PR treats passing `&(node->_pattern_path_astnode)` to `cypher_pattern_path_astnode_init` as a possible use of `node`, which suppresses this report. Removing it is correct." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcypher-parser/libcypher-parser_0.6.2.orig.tar.gz", "main libcypher-parser-0.6.2/lib/src/ast_none.c:83:5: error: Memory leak: node [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The function allocates `node` and returns `&(node->_list_comprehension_astnode._astnode)`. That is the address of embedded storage inside the allocation, and other code recovers the full object with `container_of`. Ownership passes to the caller, so there is no leak. The PR treats passing `&(node->member)` to a non-ignored function, here `cypher_list_comprehension_astnode_init`, as a possible use of `node`. That suppresses this false memleak report, and the same happens for the many identical AST constructor files in this package." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcypher-parser/libcypher-parser_0.6.2.orig.tar.gz", "main libcypher-parser-0.6.2/lib/src/ast_parameter.c:60:5: error: Memory leak: node [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The function returns `&(node->_astnode)`. That is the address of the first member of the allocation, so the caller receives a pointer to the allocated memory and later recovers it via container_of. There is no leak, and the old warning was a false positive. Before the return, `&(node->_astnode)` is passed to cypher_astnode_init, which is not configured in any library file. The PR now treats that call as a possible use of `node`, which removes the false memleak report." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcypher-parser/libcypher-parser_0.6.2.orig.tar.gz", "main libcypher-parser-0.6.2/lib/src/ast_profile_option.c:58:5: error: Memory leak: node [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The function allocates `node` with calloc, initializes the embedded `_astnode` through `cypher_astnode_init(&(node->_astnode), ...)`, and then returns `&(node->_astnode)`. Because `_astnode` is the first member, the returned pointer is the start of the allocation, so ownership passes to the caller and nothing leaks. The memleak warning was a false positive. The PR now treats passing the address of an embedded member to an unknown function as a possible use of the owning pointer, which removes this false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcypher-parser/libcypher-parser_0.6.2.orig.tar.gz", "main libcypher-parser-0.6.2/lib/src/ast_reduce.c:76:5: error: Memory leak: node [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The function callocs `node` and passes `&(node->_astnode)` to `cypher_astnode_init`. It then returns `&(node->_astnode)`, which is the address of the embedded first member. The allocation is handed back to the caller and freed later through `container_of`, so it does not leak. Main reported a memleak at the return statement, which was a false positive. The PR treats passing the address of an embedded member to a non-ignored function as a use of the owner, and that removes the false warning." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcypher-parser/libcypher-parser_0.6.2.orig.tar.gz", "main libcypher-parser-0.6.2/lib/src/ast_reltype.c:55:5: error: Memory leak: node [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The function returns `&(node->_astnode)`, which is the address of the first member of the allocated struct. That is the same address as the allocation, and callers later recover the struct with `container_of` and free it. So the memory is not leaked and main's memleak warning was a false positive. The PR marks the owner as used when the address of an embedded member is passed to a non-leak-ignore function, here `cypher_astnode_init(&(node->_astnode), ...)`. That suppresses this false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcypher-parser/libcypher-parser_0.6.2.orig.tar.gz", "main libcypher-parser-0.6.2/lib/src/ast_sort_item.c:59:5: error: Memory leak: node [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The function returns `&(node->_astnode)`. `_astnode` is the first member of the struct, so the returned pointer has the same address as the allocation, and callers later recover the struct with `container_of`. Ownership is handed to the caller, so the memleak was a false positive. The PR marks the owner as used when a member address is passed to `cypher_astnode_init`. That suppresses the warning, which is correct here." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcypher-parser/libcypher-parser_0.6.2.orig.tar.gz", "main libcypher-parser-0.6.2/lib/src/ast_string.c:60:5: error: Memory leak: node [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`node` is allocated with calloc, and `&(node->_astnode)` is passed to `cypher_astnode_init()`. The function then returns `&(node->_astnode)`, which is the first member, so it has the same address as the allocation. Ownership goes to the caller, and the memory is later freed through `container_of` / `cypher_astnode_free`. The leak report was a false positive. With the PR, passing the member's address to a non-ignored function marks `node` as possibly used, so the warning is suppressed." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcypher-parser/libcypher-parser_0.6.2.orig.tar.gz", "main libcypher-parser-0.6.2/lib/src/ast_unwind.c:66:5: error: Memory leak: node [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The function allocates `node` and returns `&(node->_astnode)`. That is the address of an embedded member, so ownership passes to the caller, who later recovers the struct with `container_of`. The pull request marks `node` as possibly used when `&node->_astnode` is passed to `cypher_astnode_init`, which is an unknown function. That removes the memleak report on the return line. The report was a false positive, so removing it is an improvement." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcypher-parser/libcypher-parser_0.6.2.orig.tar.gz", "main libcypher-parser-0.6.2/lib/src/ast_using_index.c:70:5: error: Memory leak: node [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The function calloc's `node` and returns `&(node->_astnode)`. That is the address of an embedded member. Callers later use container_of to get back to the allocation, so the memory is not leaked. The old memleak warning at line 70 was a false positive. The PR treats `&node->_astnode` passed to cypher_astnode_init (a non-ignored, non-pure function) as a possible use of `node`, which suppresses the warning. Removing it is correct." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcypher-parser/libcypher-parser_0.6.2.orig.tar.gz", "main libcypher-parser-0.6.2/lib/src/ast_using_scan.c:66:5: error: Memory leak: node [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The function allocates `node` and returns `&(node->_astnode)`. `_astnode` is the first embedded member, so the caller gets a pointer to storage inside the allocation and can recover `node` with container_of. Ownership is transferred and there is no leak. The removed warning was a false positive. It most likely disappeared because the PR now treats passing `&(node->_astnode)` to `cypher_astnode_init` as a possible use of `node`." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libn/libnl3/libnl3_3.12.0.orig.tar.gz", "main libnl-3.12.0/lib/genl/family.c:371:2: error: Memory leak: op [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`op` is allocated with calloc, and then `nl_list_add_tail(&op->o_list, &family->gf_ops)` links its embedded list node into the family's list. That is the intrusive-list ownership pattern, so the memory is still reachable through `family->gf_ops` and is freed later. Main's memleak warning at line 371 is a false positive. The PR treats passing the address of an embedded member to a non-ignored function as possible use of the owner, which removes it." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libn/libnl3/libnl3_3.12.0.orig.tar.gz", "main libnl-3.12.0/lib/genl/family.c:392:2: error: Memory leak: grp [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The code passes `&grp->list`, the address of an embedded list node, to `nl_list_add_tail()`, which links it into `family->gf_mc_grps`. That list now owns the allocation, so `grp` is not leaked. The old memleak warning was a false positive, and the PR removes it by treating the member address as a use of `grp`." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/o/otf/otf_1.12.5+dfsg.orig.tar.gz", "main otf-1.12.5+dfsg/otfauxlib/OTFAUX_Process.c:424:5: error: Memory leak: recv [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The function callocs `recv` and links it into a queue with `stack_add(&queue->receives, &recv->e)`. This is an intrusive list: `e` is embedded storage inside the allocation, so the queue keeps the memory reachable and it can be recovered later (container_of-style). Ownership is transferred, so the memleak warning was a false positive. The PR now treats passing `&recv->e` to a non-ignored function as possible use of `recv`, which removes it." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/partclone/partclone_0.3.49.orig.tar.xz", "main partclone-0.3.49/src/btrfs/check/qgroup-verify.c:917:2: error: Memory leak: list [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The function allocates `list` and passes `&list->next_group` and `&list->next_member` to `list_add_tail`. That links the embedded list nodes into `member->groups` and `parent->members`, so the allocation stays reachable through those lists and is not leaked. The PR treats passing the address of an embedded member to a non-ignored function as possible use of the owner, which removes this false positive memleak. This is the same pattern as the #6259 test case." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/pipewire/pipewire_1.6.9.orig.tar.gz", "main pipewire-1.6.9-8fa27cabdc6c0c1350c69c026af5850ef0af1e26/src/examples/gmain.c:99:2: error: Memory leak: source [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`source` is allocated with `g_source_new()`. Its embedded member `&source->base` is then passed to `g_source_add_unix_fd`, `g_source_attach` and `g_source_unref`. Attaching hands ownership to the GLib main context, and the unref releases the local reference, so nothing leaks. Main reported a memleak because it did not treat passing the address of an embedded member as a use of `p`. The PR does, so this false positive is removed." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/pipewire/pipewire_1.6.9.orig.tar.gz", "main pipewire-1.6.9-8fa27cabdc6c0c1350c69c026af5850ef0af1e26/src/modules/module-protocol-pulse/operation.c:35:2: error: Memory leak: o [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`spa_list_append(&client->operations, &o->link)` links the embedded list node of the freshly allocated `o` into the client's operation list. The memory stays reachable through that list and is freed later by `operation_free`/`operation_complete`. The memleak report at the return was a false positive. The PR now treats passing `&o->link` to an unknown function as a possible use of `o`, which removes it. This is exactly the #6259 pattern the PR targets." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/seatd/seatd_0.9.3.orig.tar.gz", "main seatd-0.9.3/libseat/backend/seatd.c:197:2: error: Memory leak: ev [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "queue_event allocates ev and passes &ev->link to linked_list_insert, which links it into backend->pending_events. Ownership moves to the list, and execute_events later frees the entries. The old memleak warning was a false positive. The PR now treats passing the address of an embedded member as a possible use of the owner, which removes it." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/t/tarantool/tarantool_2.6.0.orig.tar.gz", "main tarantool_2.6.0/test/unit/cbus_stress.c:252:1: error: Memory leak: msg [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`msg` is malloc'ed and `&msg->cmsg` is passed to `cpipe_push`, which queues the embedded member. The message is later freed in `thread_msg_received_cb` through `container_of`. So ownership is handed over through the address of an embedded member, and the memleak warning was a false positive. The PR now treats `&msg->cmsg` passed to a non-ignored function as a possible use of `msg`, which removes the false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/t/tarantool/tarantool_2.6.0.orig.tar.gz", "main tarantool_2.6.0/test/unit/swim_test_ev.c:225:1: error: Memory leak: e [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`e` is malloc'd and `&e->base` is passed to `swim_event_create()`, which registers the event; the later delete callback frees it. `e` is also stored in `events_hash` through `node`. The memory is not leaked, so the old memleak warning was a false positive. The PR treats passing the address of an embedded member as a possible use of the owning allocation, which removes it." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/u/ulogd2/ulogd2_2.0.9.orig.tar.xz", "main ulogd-2.0.9/src/ulogd.c:787:2: error: Memory leak: ph [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`load_plugin()` callocs `ph` and then calls `llist_add(&ph->list, &ulogd_plugins_handle)`. This links the embedded list node into a global list, so the allocation stays reachable and is not leaked. This is exactly the #6259 pattern the PR targets. Removing the false memleak warning is an improvement." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/u/ulogd2/ulogd2_2.0.9.orig.tar.xz", "main ulogd-2.0.9/util/db.c:453:2: error: Memory leak: query [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`llist_add_tail(&query->list, &di->backlog)` inserts the embedded list node of the freshly allocated `query` into the backlog list. That transfers ownership: the memory can be reached through the list and is freed later, e.g. in `__treat_backlog`. The old memleak warning at `return 0;` was a false positive. The PR now treats passing the address of a member embedded in the allocation as a use of `p`, so the false positive is gone." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/w/weston/weston_16.0.2.orig.tar.xz", "main weston-16.0.2/ivi-shell/ivi-layout-transition.c:223:2: error: Memory leak: node [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`node` is malloc'd and its embedded `link` member is inserted into `layout->pending_transition_list` via `wl_list_insert(..., &node->link)`. The list now holds a pointer into the allocation, so ownership is transferred. `remove_transition()` later frees it with `wl_list_remove` + `free(node)`. The memleak warning was a false positive (the #6259 pattern), and the PR removes it by treating passing `&node->link` as a use of `node`." } } ], "started": "2026-11-04 08:21:14 UTC", "runner": "pc" }