Skip to content

[Bug]: CRIT_ERR_FREE (logging.h): Free without checking for nullptr creates unresponsive process #2313

@berndf

Description

@berndf

What happened?

Conky normally reacts well to SIG_TERM. However when the wayland session is closed and it emits a "output closed" error, the conky process can only be killed by SIG_KILL. This leads to very ugly 1:30 min wait times in systemd on shutdown, as the user session won't terminate because of conky.

I tracked this to the free() calls in CRIT_ERR_FREE(), which just are calling free() on memtofree1 which is nullptr if this was called through CRIT_ERR(). If I trivially check for NULL before calling free(), the enervating behavior is fixed and conky just exits, as it should, on CRIT_ERR(). The patch is attached.

protect_free.patch

Version

1.22.2

Which OS/distro are you seeing the problem on?

Gentoo

Conky config

Stack trace

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugrelated to incorrect existing implementation of some functionalitytriageissue that hasn't been verified, categorized or acknowledged yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions