{ "tokens": { "input": 25251, "cache_read": 67524, "cache_write": 11254, "output": 2800 }, "reviews": [ { "key": [ "https://ftp.debian.org/debian/pool/main/d/dia/dia_0.98+git20260221.orig.tar.gz", "main lib/plug-ins.c:393:5: error: Memory leak: info [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`info` is allocated with g_new0 and then passed to `(* init_func)(info)`, which is a call through a function pointer. On the failure path it is freed with g_clear_pointer(&info, g_free). Cppcheck probably does not understand the g_clear_pointer macro, so main reported a leak at the return. That warning was a false positive: the memory is freed there, and on the success path it is stored in `plugins`. With the PR, the anonymous call `(* init_func)(info)` is now treated as a use of `info`, which removes this false memleak." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/phylonium/phylonium_1.7.orig.tar.gz", "main phylonium-1.7/src/sequence.cxx:130:3: error: Memory leak: str [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`str` is allocated with new[] and freed with delete[] at line 142. The warning at line 130 points at the `return table;` inside the immediately invoked lambda `([](){...})()`. Main wrongly treated that return as leaving filter_nucl and reported `str` as leaked. That was a false positive. The PR makes Cppcheck recognize the anonymous function call `(lambda)()`, so the bogus leak report is gone." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/syncevolution/syncevolution_2.0.0.orig.tar.bz2", "main syncevolution-syncevolution-2-0-0/src/dbus/glib/syncevo-server.c:430:5: error: Memory leak: error [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`error` is allocated with g_error_new_literal() and then passed to a callback through a cast function pointer: `(*(SyncevoServerGetConfigsCb)data->callback)(..., error, ...)`. Main did not recognise this as a function call, so it reported a leak. The callback could take ownership of the error, so the leak warning is a false positive. The PR treats calls through function pointers as unknown calls that may use their arguments, which removes this false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/syncevolution/syncevolution_2.0.0.orig.tar.bz2", "main syncevolution-syncevolution-2-0-0/src/dbus/glib/syncevo-server.c:489:5: error: Memory leak: error [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The function allocates the GError with g_error_new_literal and then passes it to a callback called through a cast function pointer: (*(SyncevoServerGetConfigCb)data->callback)(..., error, ...). Cppcheck cannot see what the callback does with the error, and ownership may be transferred to it, so main's leak warning was a false positive. The PR now treats calls through a function pointer as an unknown function that may take ownership of its arguments, which removes the warning." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/syncevolution/syncevolution_2.0.0.orig.tar.bz2", "main syncevolution-syncevolution-2-0-0/src/dbus/glib/syncevo-server.c:550:5: error: Memory leak: error [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`error` is allocated with g_error_new_literal and then passed to a callback through a cast function pointer: `(*(SyncevoServerGetReportsCb)data->callback)(..., error, ...)`. Ownership of the error goes to that unknown callback, so it is not leaked here. Main did not treat the function-pointer call as a use of `error` and reported a false 'Memory leak: error'. The PR adds handling for anonymous function calls, which marks the argument as passed on and removes the false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/syncevolution/syncevolution_2.0.0.orig.tar.bz2", "main syncevolution-syncevolution-2-0-0/src/dbus/glib/syncevo-server.c:613:5: error: Memory leak: error [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`error` is allocated by g_error_new_literal and then passed to the function pointer call `(*(SyncevoServerStartSessionCb)data->callback)(..., error, ...)`. That call may take ownership or free the error, so Cppcheck cannot know it leaks. Main reported a memory leak because it did not treat the anonymous function-pointer call as using the variable. The PR now handles such calls, so this false positive is gone." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/syncevolution/syncevolution_2.0.0.orig.tar.bz2", "main syncevolution-syncevolution-2-0-0/src/dbus/glib/syncevo-server.c:701:5: error: Memory leak: error [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The GError allocated with g_error_new_literal is passed to a callback through a cast function pointer: `(*(SyncevoServerGetSessionsCb)data->callback)(..., error, ...)`. Ownership may move to the callback, so cppcheck cannot prove a leak. Main did not see this as a function call and reported 'Memory leak: error'. The PR recognizes anonymous function-pointer calls and treats the argument as used, so this false positive is removed." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/syncevolution/syncevolution_2.0.0.orig.tar.bz2", "main syncevolution-syncevolution-2-0-0/src/dbus/glib/syncevo-server.c:762:5: error: Memory leak: error [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The GError is allocated with g_error_new_literal and then passed to a callback through a function pointer: (*(SyncevoServerGetPresenceCb)data->callback)(..., error, ...). Ownership may move to the callee, and in this GLib callback pattern the callback is responsible for the error. Cppcheck cannot see what the callback does, so reporting a leak was a false positive. The PR now treats calls through function pointers as possible uses of their arguments, which removes this false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/syncevolution/syncevolution_2.0.0.orig.tar.bz2", "main syncevolution-syncevolution-2-0-0/src/dbus/glib/syncevo-server.c:97:5: error: Memory leak: error [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`error` is allocated with `g_error_new_literal()` and then passed to a callback through a function pointer, `(*(SyncevoServerGenericCb)data->callback)(..., error, ...)`. Before this PR, Cppcheck ignored calls through function pointers, so it thought `error` was never passed anywhere and reported a leak. The PR now treats such calls like calls to unknown functions, which may take ownership of the argument. Here the callback does take ownership. `generic_callback` forwards the dbus-glib `GError` to the same callback type without freeing it, so the callbacks are expected to free it. The removed memleak warning was a false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/syncevolution/syncevolution_2.0.0.orig.tar.bz2", "main syncevolution-syncevolution-2-0-0/src/dbus/glib/syncevo-session.c:288:5: error: Memory leak: error [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "In generic_error(), the GError allocated by g_error_new_literal is passed to the callback through a function pointer call, (*(SyncevoSessionGenericCb)data->callback)(..., error, ...). The callback may take ownership of it or free it. Main did not recognise this cast function-pointer call as a use of 'error' and reported a leak. The PR handles anonymous function-pointer calls as possible deallocations, so this false positive is removed." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/syncevolution/syncevolution_2.0.0.orig.tar.bz2", "main syncevolution-syncevolution-2-0-0/src/dbus/glib/syncevo-session.c:360:5: error: Memory leak: error [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`get_config_error` allocates a GError with `g_error_new_literal`. It then passes `error` to a callback through a casted function pointer, `(*(SyncevoSessionGetConfigCb)data->callback)(..., error, ...)`. The callee may take ownership of the error, so the memleak report at the return was a false positive. With this PR the anonymous function-pointer call is treated as a use of the argument, which removes the false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/syncevolution/syncevolution_2.0.0.orig.tar.bz2", "main syncevolution-syncevolution-2-0-0/src/dbus/glib/syncevo-session.c:449:5: error: Memory leak: error [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`error` comes from g_error_new_literal and is then passed to the callback through a function pointer: `(*(SyncevoSessionGetReportsCb)data->callback)(..., error, ...)`. The callback takes over the error, so the leak report at the return was a false positive. Main did not treat this call through a function pointer as using the variable. The PR handles anonymous function calls, which marks `error` as passed on and removes the false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/syncevolution/syncevolution_2.0.0.orig.tar.bz2", "main syncevolution-syncevolution-2-0-0/src/dbus/glib/syncevo-session.c:595:5: error: Memory leak: error [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`error` is allocated with g_error_new_literal and then passed to a callback through a function pointer: `(*(SyncevoSessionGetStatusCb)data->callback)(..., error, ...)`. Cppcheck cannot know what the callback does with it; it may take ownership and free it. Main reported a memory leak because it ignored the call to the anonymous function. The PR now treats such calls as using or transferring the argument, so this false positive is removed." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/syncevolution/syncevolution_2.0.0.orig.tar.bz2", "main syncevolution-syncevolution-2-0-0/src/dbus/glib/syncevo-session.c:654:5: error: Memory leak: error [memleak]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`error` is allocated with g_error_new_literal() and then passed to a callback called through a function pointer: `(*(SyncevoSessionGetProgressCb)data->callback)(..., error, ...)`. Ownership can pass to the callback, which may free it. Main did not treat this anonymous call as a function call and reported a leak. The PR handles calls through a function pointer, so the false positive is removed." } } ], "started": "2026-11-13 23:59:15 UTC", "runner": "aws-testrunner-1" }