Signed-off-by: Peter Hutterer <[email protected]>
---
evemu.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/evemu.c b/evemu.c
index 2dab468..d0d2884 100644
--- a/evemu.c
+++ b/evemu.c
@@ -147,18 +147,18 @@ int evemu_load_device(struct session *session,
if (!in) {
fprintf(stderr, "Failed to open path '%s': %s\n",
input_file, strerror(errno));
- goto out;
+ goto error;
}
dev = evemu_new(NULL);
if (!dev) {
fprintf(stderr, "Failed to create evemu device.\n");
- goto out;
+ goto error;
}
if (evemu_read(dev, in) <= 0) {
fprintf(stderr, "Failed to read device data.\n");
- goto out;
+ goto error;
}
memset(name, 0, sizeof(name));
@@ -173,12 +173,18 @@ int evemu_load_device(struct session *session,
rc = hotplug_add_file(session, path);
if (rc)
- goto out;
-out:
+ goto error;
+
+ fclose(in);
+ return monitored_device_add(session->devices, evemu_init, dev, path);
+
+error:
if (in)
fclose(in);
+ if (dev)
+ evemu_delete(dev);
+ return 1;
- return !rc ? monitored_device_add(session->devices, evemu_init, dev,
path) : rc;
}
int add_device_desc(struct session *session, char *path, char *desc)
--
1.7.11.2
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel