[PATCH evemu 7/7] tools: handle asprintf errors

Peter Hutterer peter.hutterer at who-t.net
Tue Aug 18 18:03:30 PDT 2015


shush, coverity, shush

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 tools/find_event_devices.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/find_event_devices.c b/tools/find_event_devices.c
index 86d4e6a..a73d08f 100644
--- a/tools/find_event_devices.c
+++ b/tools/find_event_devices.c
@@ -84,9 +84,9 @@ char* find_event_devices(void)
 	if (rc != 1 || devnum > max_device || devnum < 0)
 		return NULL;
 
-	asprintf(&filename, "%s/%s%d",
-		 DEV_INPUT_EVENT, EVENT_DEV_NAME,
-		 devnum);
+	rc = asprintf(&filename, "%s/%s%d",
+		      DEV_INPUT_EVENT, EVENT_DEV_NAME,
+		      devnum);
 
-	return filename;
+	return rc == -1 ? NULL : filename;
 }
-- 
2.4.3



More information about the Input-tools mailing list