]> git.ipfire.org Git - thirdparty/systemd.git/commit
alloc-util: introduce new helper alloca_safe()
authorLennart Poettering <lennart@poettering.net>
Wed, 13 Oct 2021 10:05:54 +0000 (12:05 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 14 Oct 2021 13:57:52 +0000 (15:57 +0200)
commit9e1a759903a3ff9943334d25de19b06afc40c11e
treeaa197bafb029b50dc9002127601165b6bb5a09a1
parenta69f1dd9ca2a8eb20bf75083a4199c8791d55bf8
alloc-util: introduce new helper alloca_safe()

This is like alloca(), but does two things:

1. Verifies the allocation is smaller than ALLOCA_MAX
2. Ensures we allocate at least one byte

This was previously done manually in all invocations. This adds a handy
helper that does that implicitly.
src/basic/alloc-util.h