summaryrefslogtreecommitdiff
path: root/serial.c
diff options
context:
space:
mode:
authorstefanct <stefanct@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2011-07-12 22:35:21 +0000
committerstefanct <stefanct@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2011-07-12 22:35:21 +0000
commit3db592f8baf6c9a799a48f7c12b6da39329f075a (patch)
treeee762ee7695c977df7c4174fb263308a26b543cf /serial.c
parent6dc4f8f3ddc4d5260cd302155a5d7d2101a118df (diff)
downloadflashrom-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 '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);
}