mirror of
https://github.com/troglobit/finit.git
synced 2026-10-28 12:30:44 +00:00
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:
1 parent
c57bd066d1
commit
bcfcafdb7c
1 file changed
+1
-1
@@ -71,7 +71,7 @@ int tty_register(char *line)
|
|||||||
entry = tty_find(dev);
|
entry = tty_find(dev);
|
||||||
if (!entry) {
|
if (!entry) {
|
||||||
insert = 1;
|
insert = 1;
|
||||||
entry = malloc(sizeof(*entry));
|
entry = calloc(1, sizeof(*entry));
|
||||||
if (!entry)
|
if (!entry)
|
||||||
return errno = ENOMEM;
|
return errno = ENOMEM;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user