HomeClusterLabs Projects

Refactor: libcrmcommon: New pcmk__assert_alloc()

Description

Refactor: libcrmcommon: New pcmk__assert_alloc()

Wrapper for calloc() with NULL-check.

  • Leave public and internal libraries alone where they currently NULL- check.
  • Continue asserting in places where we already assert.
  • Assert where we currently dereference the result without NULL-checking it, which should end in a seg fault.
  • Always assert on failed memory allocation in daemons -- if they don't fail now, they will soon.
  • Did not use with systemd_new_method() yet; perhaps something else might cause that to fail besides out-of-memory(?).

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>

Details

Provenance
nrwahl2Authored on Mar 12 2024, 10:54 AM
Parents
rP605895685d1d: Refactor: libcrmcommon: New pcmk__mem_assert()
Branches
Unknown
Tags
Unknown