mirror of
https://gitlab.freedesktop.org/libevdev/libevdev.git
synced 2025-12-25 04:40:05 +01:00
uinput: check for asprintf failure
This doesn't really do much here, but strictly speaking: if asprintf returns -1, devnode is undefined. So reset it to NULL to avoid weird pointers. And also free the rest of the names if we ever have more than one device - which also shouldn't happen. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This commit is contained in:
parent
2ad8980c5a
commit
f29008b758
1 changed files with 2 additions and 1 deletions
|
|
@ -179,7 +179,8 @@ fetch_device_node(const char *path)
|
|||
/* ndev should only ever be 1 */
|
||||
|
||||
for (i = 0; i < ndev; i++) {
|
||||
asprintf(&devnode, "/dev/input/%s", namelist[i]->d_name);
|
||||
if (!devnode && asprintf(&devnode, "/dev/input/%s", namelist[i]->d_name) == -1)
|
||||
devnode = NULL;
|
||||
free(namelist[i]);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue