From 374a7a4f4140d2392f1771772c11b06c4122a988 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 18 Mar 2024 16:26:45 +1000 Subject: [PATCH] Don't unref a null gobjec This path may be triggered if parent is NULL, calling g_object_unref on it will trigger a warning. This is unlikely to be triggered outside a custom test setup. --- libwacom/libwacom.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c index c606e484..957bbd37 100644 --- a/libwacom/libwacom.c +++ b/libwacom/libwacom.c @@ -249,7 +249,8 @@ get_device_info (const char *path, parent = g_udev_device_get_parent(device); if (!parent || !is_tablet_or_touchpad(parent)) { libwacom_error_set(error, WERROR_INVALID_PATH, "Device '%s' is not a tablet", path); - g_object_unref (parent); + if (parent) + g_object_unref (parent); goto out; } g_object_unref (parent);