[tslib] [PATCH v0 1/3] Fix memory handling of uinput_name
Markus Burri
markus.burri at mt.com
Mon Mar 27 07:59:06 PDT 2023
Currently we free unallocated memory in case we don't use the default
name and add the name as argument.
Since we use string constant or string arg parameter it is save to use
the string direct and there is no need for dynamic memory allocation.
Signed-off-by: Markus Burri <markus.burri at mt.com>
Gbp-Pq: Name 0009-Fix-memory-handling-of-uinput_name.patch
---
tools/ts_uinput.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/tools/ts_uinput.c b/tools/ts_uinput.c
index 912ff72..9b54f18 100644
--- a/tools/ts_uinput.c
+++ b/tools/ts_uinput.c
@@ -668,9 +668,6 @@ static void cleanup(struct data_t *data)
if (data->fd_fb)
close(data->fd_fb);
-
- if (data->uinput_name)
- free(data->uinput_name);
}
/* directly from libevdev (LGPL) */
@@ -862,10 +859,7 @@ int main(int argc, char **argv)
}
if (!data.uinput_name) {
- data.uinput_name = malloc(strlen(DEFAULT_UINPUT_NAME) + 1);
- if (!data.uinput_name)
- return errno;
- sprintf(data.uinput_name, DEFAULT_UINPUT_NAME);
+ data.uinput_name = DEFAULT_UINPUT_NAME;
}
if (!data.nofb) {
--
2.39.2
More information about the tslib
mailing list