mirror of
https://github.com/troglobit/finit.git
synced 2026-11-18 19:30:56 +00:00
Fix resource leak if tty_register() fails (minor)
Found by Coverity Scan. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
8cfd11c909
commit
512a07a25c
1 file changed
+5
-1
@@ -75,8 +75,12 @@ int tty_register(char *line)
|
|||||||
if (!entry) {
|
if (!entry) {
|
||||||
insert = 1;
|
insert = 1;
|
||||||
entry = calloc(1, sizeof(*entry));
|
entry = calloc(1, sizeof(*entry));
|
||||||
if (!entry)
|
if (!entry) {
|
||||||
|
if (baud)
|
||||||
|
free(baud);
|
||||||
|
|
||||||
return errno = ENOMEM;
|
return errno = ENOMEM;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entry->data.name = strdup(dev);
|
entry->data.name = strdup(dev);
|
||||||
|
|||||||
Reference in new issue
Block a user