From 7df14502a208c8ae9ddc327ae6eba5cb17bda718 Mon Sep 17 00:00:00 2001 From: Gleb Popov <6yearold@gmail.com> Date: Sun, 3 May 2026 13:37:19 +0300 Subject: [PATCH] Make udev_unref() handle NULL This is what the real libudev does, see https://github.com/systemd/systemd/blob/a3502284def364235a9c31b016738607a75ddddc/src/libudev/libudev.c#L99-L100 There is code in the wild that depends on this behavior. --- udev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udev.c b/udev.c index 92fadee..4a9e34b 100644 --- a/udev.c +++ b/udev.c @@ -76,6 +76,8 @@ LIBUDEV_EXPORT void udev_unref(struct udev *udev) { + if (!udev) + return; TRC("(%p) refcount=%d", udev, udev->refcount); _udev_unref(udev); }