diff options
author | stefanct <stefanct@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1> | 2011-07-12 22:35:21 +0000 |
---|---|---|
committer | stefanct <stefanct@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1> | 2011-07-12 22:35:21 +0000 |
commit | 3db592f8baf6c9a799a48f7c12b6da39329f075a (patch) | |
tree | ee762ee7695c977df7c4174fb263308a26b543cf /hwaccess.c | |
parent | 6dc4f8f3ddc4d5260cd302155a5d7d2101a118df (diff) | |
download | flashrom-3db592f8baf6c9a799a48f7c12b6da39329f075a.tar.gz |
fix unchecked malloc calls and casts of malloc return values
in the long term the exit calls should be replaced by returns.
until then this is the correct way to handle failures.
the casts are not needed (in C) and we don't cast malloc return values anywhere else.
Signed-off-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@1370 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'hwaccess.c')
-rw-r--r-- | hwaccess.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -226,6 +226,10 @@ int undo_mmio_write(void *p) { \ struct undo_mmio_write_data *undo_mmio_write_data; \ undo_mmio_write_data = malloc(sizeof(struct undo_mmio_write_data)); \ + if (!undo_mmio_write_data) { \ + msg_gerr("Out of memory!\n"); \ + exit(1); \ + } \ undo_mmio_write_data->addr = a; \ undo_mmio_write_data->type = mmio_write_type_##c; \ undo_mmio_write_data->c##data = mmio_read##c(a); \ |