summaryrefslogtreecommitdiffstats
path: root/serial.c
diff options
context:
space:
mode:
authorStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2011-07-12 22:35:21 +0000
committerStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2011-07-12 22:35:21 +0000
commitcf4feacdcd1256b1a9a377ada242daa5681b7a83 (patch)
treeee762ee7695c977df7c4174fb263308a26b543cf /serial.c
parent6615e88b27230a74f9afea94b92a54a7d18c581b (diff)
downloadflashrom-cf4feacdcd1256b1a9a377ada242daa5681b7a83.zip
flashrom-cf4feacdcd1256b1a9a377ada242daa5681b7a83.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. Corresponding to flashrom svn r1370. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
Diffstat (limited to 'serial.c')
-rw-r--r--serial.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/serial.c b/serial.c
index 5cc2fe0..b504974 100644
--- a/serial.c
+++ b/serial.c
@@ -110,6 +110,8 @@ fdtype sp_openserport(char *dev, unsigned int baud)
(tolower((unsigned char)dev[1]) == 'o') &&
(tolower((unsigned char)dev[2]) == 'm')) {
dev2 = malloc(strlen(dev) + 5);
+ if (!dev2)
+ sp_die("Error: Out of memory");
strcpy(dev2, "\\\\.\\");
strcpy(dev2 + 4, dev);
}
OpenPOWER on IntegriCloud