* [PATCH 1/3] udevd: unref udev device in error path
@ 2010-08-06 7:23 Yin Kangkai
2010-08-08 18:31 ` Martin Pitt
0 siblings, 1 reply; 2+ messages in thread
From: Yin Kangkai @ 2010-08-06 7:23 UTC (permalink / raw)
To: linux-hotplug
From 09610e30e2b2c087393afe1d620e5e6d75271503 Mon Sep 17 00:00:00 2001
From: Yin Kangkai <kangkai.yin@intel.com>
Date: Thu, 5 Aug 2010 11:47:48 +0800
Subject: [PATCH 1/3] udevd: unref udev device in error path
Signed-off-by: Yin Kangkai <kangkai.yin@intel.com>
---
udev/udevd.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/udev/udevd.c b/udev/udevd.c
index 2808117..6dc9795 100644
--- a/udev/udevd.c
+++ b/udev/udevd.c
@@ -402,13 +402,13 @@ static void event_run(struct event *event, bool force)
worker_new(event);
}
-static void event_queue_insert(struct udev_device *dev)
+static int event_queue_insert(struct udev_device *dev)
{
struct event *event;
event = calloc(1, sizeof(struct event));
if (event = NULL)
- return;
+ return -1;
event->udev = udev_device_get_udev(dev);
event->dev = dev;
@@ -429,8 +429,10 @@ static void event_queue_insert(struct udev_device *dev)
/* run all events with a timeout set immediately */
if (udev_device_get_timeout(dev) > 0) {
event_run(event, true);
- return;
+ return 0;
}
+
+ return 0;
}
static void worker_kill(struct udev *udev, int retain)
@@ -1351,9 +1353,8 @@ int main(int argc, char *argv[])
dev = udev_monitor_receive_device(monitor);
if (dev != NULL)
- event_queue_insert(dev);
- else
- udev_device_unref(dev);
+ if (event_queue_insert(dev) < 0)
+ udev_device_unref(dev);
}
/* start new events */
--
1.6.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/3] udevd: unref udev device in error path
2010-08-06 7:23 [PATCH 1/3] udevd: unref udev device in error path Yin Kangkai
@ 2010-08-08 18:31 ` Martin Pitt
0 siblings, 0 replies; 2+ messages in thread
From: Martin Pitt @ 2010-08-08 18:31 UTC (permalink / raw)
To: linux-hotplug
Hello Yin,
Yin Kangkai [2010-08-06 15:23 +0800]:
> udevd: unref udev device in error path
Ah, nice catch! Applied.
Thanks,
Martin
--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-08-08 18:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-06 7:23 [PATCH 1/3] udevd: unref udev device in error path Yin Kangkai
2010-08-08 18:31 ` Martin Pitt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).