diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2014-08-08 12:49:07 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2014-08-08 12:49:07 +1000 |
commit | 4ea99348fb66152d4ac65b7951b2c8e2223e3fb7 (patch) | |
tree | b8ea4b83a35a49b2e441916359c37674448b713b | |
parent | c0fdef44a475acacd6fab3883681855687a9b296 (diff) | |
download | external_evtest-4ea99348fb66152d4ac65b7951b2c8e2223e3fb7.tar.gz external_evtest-4ea99348fb66152d4ac65b7951b2c8e2223e3fb7.tar.bz2 external_evtest-4ea99348fb66152d4ac65b7951b2c8e2223e3fb7.zip |
Free the file name on error
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | evtest.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -946,7 +946,7 @@ static int test_grab(int fd) static int do_capture(const char *device) { int fd; - char *filename; + char *filename = NULL; if (!device) { fprintf(stderr, "No device specified, trying to scan all of %s/%s*\n", @@ -970,14 +970,14 @@ static int do_capture(const char *device) fprintf(stderr, "You do not have access to %s. Try " "running as root instead.\n", filename); - return EXIT_FAILURE; + goto error; } if (!isatty(fileno(stdout))) setbuf(stdout, NULL); if (print_device_info(fd)) - return EXIT_FAILURE; + goto error; printf("Testing ... (interrupt to exit)\n"); @@ -998,6 +998,10 @@ static int do_capture(const char *device) free(filename); return print_events(fd); + +error: + free(filename); + return EXIT_FAILURE; } /** |