tty: Use calloc() instead of malloc() to prevent uninitialized errors.

On some platforms GCC does not zero the heap. This can lead to
serious problems, e.g., tty->pid may be non-zero while never
having been started.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2013-06-06 18:19:26 +02:00
parent c57bd066d1
commit bcfcafdb7c
+1 -1
View File
@@ -71,7 +71,7 @@ int tty_register(char *line)
entry = tty_find(dev);
if (!entry) {
insert = 1;
entry = malloc(sizeof(*entry));
entry = calloc(1, sizeof(*entry));
if (!entry)
return errno = ENOMEM;
}