tty: Check input arguments for invalid tty before adding.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2013-05-22 12:36:19 +02:00
1 parent 56ef3f75d3
commit 263036045a
1 file changed
+5 -1
+5 -1
View File
@@ -50,8 +50,12 @@ typedef struct node {
LIST_HEAD(, node) node_list = LIST_HEAD_INITIALIZER();
int tty_add(char *tty, int baud)
{
node_t *entry = malloc(sizeof(*entry));
node_t *entry;
if (!tty)
return errno = EINVAL;
entry = malloc(sizeof(*entry));
if (!entry)
return errno = ENOMEM;