udevd: worker - allow passing NULL to worker_unref()

This commit is contained in:
Tom Gundersen
2015-05-06 17:36:39 +02:00
parent 8b46c3fc48
commit c4fcf70a01

View File

@@ -150,8 +150,7 @@ static void worker_cleanup(struct worker *worker) {
}
static void worker_unref(struct worker *worker) {
worker->refcount--;
if (worker->refcount > 0)
if (!worker || (-- worker->refcount) > 0)
return;
log_debug("worker ["PID_FMT"] cleaned up", worker->pid);
worker_cleanup(worker);