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>
diff --git a/hwaccess.c b/hwaccess.c
index efe8bb0..8c89925 100644
--- a/hwaccess.c
+++ b/hwaccess.c
@@ -226,6 +226,10 @@
 {									\
 	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);		\