AI review of 2026-10-26_14-48-08-a0fa6fb5bc33-results.txt PR: #8813 https://github.com/cppcheck-opensource/cppcheck/pull/8813 Tested: a0fa6fb5bc3338895ca39181ff2dc96faaaa002b Merge base: a202452f8394a0a990ec71f5625a10dbce5e58df Reviewed: 2026-11-01 07:28:27 UTC Model: claude-opus-5-5 (effort high) Results: 12 reviewed of 12 in the report Verdicts: 12 improvement Tokens: 22884 input, 60192 cache read, 5472 cache write, 2247 output The verdicts are written by AI and can be wrong. ---- 1 / 12 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/s/syncevolution/syncevolution_2.0.0.orig.tar.bz2 Result: main syncevolution-syncevolution-2-0-0/src/dbus/glib/syncevo-server.c:430:5: error: Memory leak: error [memleak] Explanation: `get_configs_error` allocates `error` with `g_error_new_literal` and then passes it to a callback through a function pointer: `(*(SyncevoServerGetConfigsCb)data->callback)(..., error, ...)`. Cppcheck cannot tell what that callback does, and passing the pointer on is a transfer of ownership or use. The callback convention here hands the GError to the callee. Main missed the call and reported a leak at `return FALSE`. The pull request now treats `(*fptr)(args)` as a function call, so `error` is no longer seen as leaked. The removed warning was a false positive. ---- 2 / 12 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/s/syncevolution/syncevolution_2.0.0.orig.tar.bz2 Result: main syncevolution-syncevolution-2-0-0/src/dbus/glib/syncevo-server.c:489:5: error: Memory leak: error [memleak] Explanation: `error` is allocated with g_error_new_literal and then passed to the callback through the function pointer `(*(SyncevoServerGetConfigCb)data->callback)(..., error, ...)`. The callback takes ownership of `error`, or at least gets it, so the leak report was a false positive. The PR now treats calls through function pointers as using their arguments, which removes this false memleak. ---- 3 / 12 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/s/syncevolution/syncevolution_2.0.0.orig.tar.bz2 Result: main syncevolution-syncevolution-2-0-0/src/dbus/glib/syncevo-server.c:550:5: error: Memory leak: error [memleak] Explanation: `error` is allocated by g_error_new_literal and then passed to the callback through a function pointer: `(*(SyncevoServerGetReportsCb)data->callback)(..., error, ...)`. The callback takes ownership of it, which is the usual GLib async error pattern. Cppcheck cannot see what the callee does, so it must treat the variable as escaping, the same as for any unknown function. Main missed this indirect call and reported a false memory leak. The PR recognizes `(*fptr)(args)` as a function call and removes the false positive. ---- 4 / 12 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/s/syncevolution/syncevolution_2.0.0.orig.tar.bz2 Result: main syncevolution-syncevolution-2-0-0/src/dbus/glib/syncevo-server.c:613:5: error: Memory leak: error [memleak] Explanation: In start_session_error, the GError allocated by g_error_new_literal is passed to the callback through a function pointer: (*(SyncevoServerStartSessionCb)data->callback)(..., error, ...). The callback receives the pointer and can take ownership of it, for example by freeing it. Cppcheck cannot know what the callback does, so reporting a definite memory leak here is a false positive. Before the PR, Cppcheck did not treat this anonymous function-pointer call as a use of 'error' and reported a leak at the return. The PR now handles the call, so the false positive is removed. ---- 5 / 12 ---- Verdict: IMPROVEMENT (medium confidence) Package: https://ftp.debian.org/debian/pool/main/s/syncevolution/syncevolution_2.0.0.orig.tar.bz2 Result: main syncevolution-syncevolution-2-0-0/src/dbus/glib/syncevo-server.c:701:5: error: Memory leak: error [memleak] Explanation: `get_sessions_error` allocates `error` with `g_error_new_literal` and passes it to a callback through a function pointer: `(*(SyncevoServerGetSessionsCb)data->callback)(..., error, ...)`. Cppcheck cannot know whether that callback frees the error. In GLib callback conventions the callee may well take ownership. Before this PR, Cppcheck ignored anonymous function-pointer calls, so it reported a leak at the return. With the PR, the call counts as a use of `error`, and the warning is gone. That is the intended behavior for code Cppcheck cannot analyze. Removing this likely false positive is an improvement. ---- 6 / 12 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/s/syncevolution/syncevolution_2.0.0.orig.tar.bz2 Result: main syncevolution-syncevolution-2-0-0/src/dbus/glib/syncevo-server.c:762:5: error: Memory leak: error [memleak] Explanation: The GError allocated by g_error_new_literal is passed to the callback through a function pointer, `(*(SyncevoServerGetPresenceCb)data->callback)(..., error, ...)`. The callback takes ownership of it or may free it, so Cppcheck cannot know it leaks. The PR treats arguments to anonymous/function-pointer calls as used (NOALLOC), which removes this false positive memleak report. ---- 7 / 12 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/s/syncevolution/syncevolution_2.0.0.orig.tar.bz2 Result: main syncevolution-syncevolution-2-0-0/src/dbus/glib/syncevo-server.c:97:5: error: Memory leak: error [memleak] Explanation: `error` is allocated with g_error_new_literal() and then passed to a function pointer call: `(*(SyncevoServerGenericCb)data->callback)(..., error, ...)`. Main did not see this as a function call, so it did not notice that `error` escapes to the callback. The callback may take ownership and free it. Reporting a definite leak at `return FALSE` is therefore a false positive. The PR treats anonymous function-pointer calls as calls that may consume their arguments, so the false positive is gone. ---- 8 / 12 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/s/syncevolution/syncevolution_2.0.0.orig.tar.bz2 Result: main syncevolution-syncevolution-2-0-0/src/dbus/glib/syncevo-session.c:288:5: error: Memory leak: error [memleak] Explanation: generic_error() allocates a GError with g_error_new_literal() and passes it to a callback through a function pointer: (*(SyncevoSessionGenericCb)data->callback)(..., error, ...). The callback can take ownership and free the error, so reporting a leak at the return is a false positive. The PR treats variables passed to anonymous or function-pointer calls as used, which removes this false positive. ---- 9 / 12 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/s/syncevolution/syncevolution_2.0.0.orig.tar.bz2 Result: main syncevolution-syncevolution-2-0-0/src/dbus/glib/syncevo-session.c:360:5: error: Memory leak: error [memleak] Explanation: `error` is allocated with g_error_new_literal and then passed to a callback called through a function pointer: `(*(SyncevoSessionGetConfigCb)data->callback)(..., error, ...)`. Cppcheck cannot see what the callback does with it, and in this API the callback takes ownership. So the old memleak report was a false positive. The PR now treats arguments passed to a call through a function pointer as possibly used or freed, so this false positive is gone. ---- 10 / 12 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/s/syncevolution/syncevolution_2.0.0.orig.tar.bz2 Result: main syncevolution-syncevolution-2-0-0/src/dbus/glib/syncevo-session.c:449:5: error: Memory leak: error [memleak] Explanation: The GError allocated by g_error_new_literal is passed to the callback through a function pointer call `(*(SyncevoSessionGetReportsCb)data->callback)(..., error, ...)`. Because the callback receives the pointer, it may take ownership and free it, so Cppcheck cannot prove a leak. Main reported a memleak because it did not recognise the call through a function pointer. The PR now treats such anonymous calls as using their arguments, which removes this false positive. ---- 11 / 12 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/s/syncevolution/syncevolution_2.0.0.orig.tar.bz2 Result: main syncevolution-syncevolution-2-0-0/src/dbus/glib/syncevo-session.c:595:5: error: Memory leak: error [memleak] Explanation: `error` is allocated by g_error_new_literal and then passed to the callback through a function pointer call, `(*(SyncevoSessionGetStatusCb)data->callback)(..., error, ...)`. The callback can take ownership of `error` and free it. Main did not see this anonymous call, so it reported a memory leak at the return. The PR now treats the pointer passed to the function-pointer call as used, so the false positive is gone. ---- 12 / 12 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/s/syncevolution/syncevolution_2.0.0.orig.tar.bz2 Result: main syncevolution-syncevolution-2-0-0/src/dbus/glib/syncevo-session.c:654:5: error: Memory leak: error [memleak] Explanation: `error` comes from g_error_new_literal and is then passed to the callback through a function pointer: `(*(SyncevoSessionGetProgressCb)data->callback)(..., error, ...)`. The callback may take ownership of it and free it, so Cppcheck cannot know it leaks. Main ignored this anonymous call and reported a leak, which is a false positive. The PR treats variables passed to anonymous or function-pointer calls as used, which removes the false positive.