fa73875f3c
The xmalloc wrapper checks whether the malloc succeeded, and if not stops execution and prints a message. xmalloc always returns a valid pointer. The xzalloc wrapper does the same thing, but also zeroes the memory before returning it. Old-Change-Id: I00e7de04a5c368ab3603530b98bd3e3596e10632 Signed-off-by: Gabe Black <gabeblack@google.com> Reviewed-on: https://chromium-review.googlesource.com/178001 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: David Hendricks <dhendrix@chromium.org> Commit-Queue: Gabe Black <gabeblack@chromium.org> Tested-by: Gabe Black <gabeblack@chromium.org> (cherry picked from commit 4029796d4f66601e33ae3038dbfc3299f56baf89) libpayload: malloc: Fix xmalloc() for zero byte allocations The C standard considers it legal to return a NULL pointer for zero length memory allocations, and our malloc implementation does in fact make use of that. xmalloc() and xzmalloc() should therefore not consider this case a failure. Also fixed a minor formatting issue. Old-Change-Id: Ib9b75df9458ce2ba75fd0bc0af9814a3323298eb Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/178725 Reviewed-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: David Hendricks <dhendrix@chromium.org> (cherry picked from commit 3033437e9d89c6072464860ea50ea27dcb76fe54) Squashed 2 libpayload malloc related commits. Change-Id: I682ef5f4aad58c93ae2be40e2edc1fd29e5d0438 Signed-off-by: Isaac Christensen <isaac.christensen@se-eng.com> Reviewed-on: http://review.coreboot.org/6890 Tested-by: build bot (Jenkins) Reviewed-by: David Hendricks <dhendrix@chromium.org> |
||
---|---|---|
.. | ||
bayou | ||
coreinfo | ||
external | ||
libpayload | ||
nvramcui | ||
tianocoreboot |