Bugzilla Automation <[email protected]> has asked freebsd-desktop (Team) <[email protected]> for maintainer-feedback: Bug 297619: sysutils/consolekit2: Fix CkProcessStat leak when process lookup fails https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=297619
--- Description --- The FreeBSD backend of sysutils/consolekit2 leaks a CkProcessStat allocation whenever ck_process_stat_new_for_unix_pid() fails to obtain information about the requested process. The function allocates proc with g_new0() and passes it to stat2proc(). On success, ownership is returned to the caller. On failure, however, the function sets *stat to NULL without freeing proc. stat2proc() can fail when the kern.proc.pid sysctl fails, for example if the process exits during the lookup. Repeated failures in the long-running ConsoleKit daemon can therefore accumulate leaked allocations. The attached patch calls g_free(proc) on the failure path before setting *stat to NULL. The successful ownership path remains unchanged.
