pgagroal
pgagroal copied to clipboard
malloc question
https://github.com/agroal/pgagroal/blob/ce557da1539ff92e052845d8a0cfd059e40bc236/src/libpgagroal/message.c#L952-L955 what happens if malloc returns null?
While pgagroal has a very low memory allocation rate there is def work needed on all error paths - including the one you pointed out.
Likely need a fault injection framework like - https://github.com/jesperpedersen/libfaults - to get through them all; including call sites.
I welcome contributions to both projects within this space !
try use
cppcheck -j"$(nproc)" --verbose --force --enable=all --suppress=variableScope . 2> check.err
and automate it on test builds
In this case, do we return only the error code, something like if (m == NULL) return MESSAGE_STATUS_ERROR;
?
Do we also need to log the error somewhere?
Yeah, we should use a pgagroal_log_fatal()