Skip to content

Commit

Permalink
Don't unref a null gobjec
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
whot committed Mar 18, 2024
1 parent 1098801 commit 2d0abc4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libwacom/libwacom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2d0abc4

Please sign in to comment.