X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flibudev%2Flibudev-queue.c;h=2cb4d67121641351fc5fb7a49eec5e9cbc3020c8;hb=f0f2e63bb2d5cd27e6a2464ee46a670a3159c5da;hp=0dd20313d9fe892dad73a1256b83041bd55bc002;hpb=090be8653471e1abe3f1cdd32eaad0fbd65f85cd;p=elogind.git diff --git a/src/libudev/libudev-queue.c b/src/libudev/libudev-queue.c index 0dd20313d..2cb4d6712 100644 --- a/src/libudev/libudev-queue.c +++ b/src/libudev/libudev-queue.c @@ -69,7 +69,7 @@ _public_ struct udev_queue *udev_queue_new(struct udev *udev) if (udev == NULL) return NULL; - udev_queue = calloc(1, sizeof(struct udev_queue)); + udev_queue = new0(struct udev_queue, 1); if (udev_queue == NULL) return NULL; udev_queue->refcount = 1; @@ -101,7 +101,7 @@ _public_ struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue) * Drop a reference of a udev queue context. If the refcount reaches zero, * the resources of the queue context will be released. * - * Returns: the passed queue context if it has still an active reference, or #NULL otherwise. + * Returns: #NULL **/ _public_ struct udev_queue *udev_queue_unref(struct udev_queue *udev_queue) { @@ -109,7 +109,7 @@ _public_ struct udev_queue *udev_queue_unref(struct udev_queue *udev_queue) return NULL; udev_queue->refcount--; if (udev_queue->refcount > 0) - return udev_queue; + return NULL; udev_list_cleanup(&udev_queue->queue_list); free(udev_queue); return NULL;