1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-01 22:21:16 +02:00

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.

Corresponding to flashrom svn r1370.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
This commit is contained in:
Stefan Tauner
2011-07-12 22:35:21 +00:00
parent ff56267ec0
commit 269de3533a
4 changed files with 25 additions and 3 deletions

View File

@ -295,6 +295,10 @@ int undo_pci_write(void *p)
{ \
struct undo_pci_write_data *undo_pci_write_data; \
undo_pci_write_data = malloc(sizeof(struct undo_pci_write_data)); \
if (!undo_pci_write_data) { \
msg_gerr("Out of memory!\n"); \
exit(1); \
} \
undo_pci_write_data->dev = *a; \
undo_pci_write_data->reg = b; \
undo_pci_write_data->type = pci_write_type_##c; \