mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 14:00:29 +01:00
evdev: use autofree for the sysname
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1193>
This commit is contained in:
parent
43c4224e56
commit
b481170918
1 changed files with 2 additions and 5 deletions
|
|
@ -2385,7 +2385,7 @@ evdev_device_create(struct libinput_seat *seat,
|
|||
int fd = -1;
|
||||
int unhandled_device = 0;
|
||||
const char *devnode = udev_device_get_devnode(udev_device);
|
||||
char *sysname = str_sanitize(udev_device_get_sysname(udev_device));
|
||||
_autofree_ char *sysname = str_sanitize(udev_device_get_sysname(udev_device));
|
||||
|
||||
if (!devnode) {
|
||||
log_info(libinput, "%s: no device node associated\n", sysname);
|
||||
|
|
@ -2415,8 +2415,7 @@ evdev_device_create(struct libinput_seat *seat,
|
|||
goto err;
|
||||
|
||||
device = zalloc(sizeof *device);
|
||||
device->sysname = sysname;
|
||||
sysname = NULL;
|
||||
device->sysname = steal(&sysname);
|
||||
|
||||
libinput_device_init(&device->base, seat);
|
||||
libinput_seat_ref(seat);
|
||||
|
|
@ -2490,8 +2489,6 @@ err:
|
|||
}
|
||||
}
|
||||
|
||||
free(sysname);
|
||||
|
||||
return unhandled_device ? EVDEV_UNHANDLED_DEVICE : NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue