Discussion:
[Linuxwacom-devel] [PATCH libwacom] Handle error case of missing parent
Peter Hutterer
2016-08-15 04:37:01 UTC
Permalink
Signed-off-by: Peter Hutterer <***@who-t.net>
---
Not 100% why this is triggered, but when devices are added/removed like
crazy (running the libinput test suite with the server trying to pick all of
them up) the parent can sometimes be null.

libwacom/libwacom.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c
index 863dc2a..5ab0ab5 100644
--- a/libwacom/libwacom.c
+++ b/libwacom/libwacom.c
@@ -267,6 +267,8 @@ get_device_info (const char *path,
GUdevDevice *parent;

parent = g_udev_device_get_parent (device);
+ if (!parent)
+ goto out;
*name = g_strdup (g_udev_device_get_sysfs_attr (parent, "name"));
g_object_unref (parent);
}
--
2.7.4
Ping Cheng
2016-08-15 21:23:02 UTC
Permalink
On Sun, Aug 14, 2016 at 9:37 PM, Peter Hutterer
Post by Peter Hutterer
---
Not 100% why this is triggered, but when devices are added/removed like
crazy (running the libinput test suite with the server trying to pick all of
them up) the parent can sometimes be null.
It at least serves as a safeguard. So,

Acked-by: Ping Cheng <***@wacom.com>.

Cheers,

Ping
Post by Peter Hutterer
libwacom/libwacom.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c
index 863dc2a..5ab0ab5 100644
--- a/libwacom/libwacom.c
+++ b/libwacom/libwacom.c
@@ -267,6 +267,8 @@ get_device_info (const char *path,
GUdevDevice *parent;
parent = g_udev_device_get_parent (device);
+ if (!parent)
+ goto out;
*name = g_strdup (g_udev_device_get_sysfs_attr (parent, "name"));
g_object_unref (parent);
}
--
2.7.4
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. http://sdm.link/zohodev2dev
_______________________________________________
Linuxwacom-devel mailing list
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
Loading...