[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] threadpool: Check for NULL jobdata



Do nothing if caller passes NULL as jobdata to virThreadPoolSendJob().
---
 src/util/threadpool.c |    3 +++
 src/util/threadpool.h |    1 -
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/util/threadpool.c b/src/util/threadpool.c
index 1213862..2907478 100644
--- a/src/util/threadpool.c
+++ b/src/util/threadpool.c
@@ -192,6 +192,9 @@ int virThreadPoolSendJob(virThreadPoolPtr pool,
 {
     virThreadPoolJobPtr job;
 
+    if (!jobData)
+        return -1;
+
     virMutexLock(&pool->mutex);
     if (pool->quit)
         goto error;
diff --git a/src/util/threadpool.h b/src/util/threadpool.h
index 5714b0b..8b8c676 100644
--- a/src/util/threadpool.h
+++ b/src/util/threadpool.h
@@ -42,7 +42,6 @@ void virThreadPoolFree(virThreadPoolPtr pool);
 
 int virThreadPoolSendJob(virThreadPoolPtr pool,
                          void *jobdata) ATTRIBUTE_NONNULL(1)
-                                        ATTRIBUTE_NONNULL(2)
                                         ATTRIBUTE_RETURN_CHECK;
 
 #endif
-- 
1.7.3.1


-- 
Thanks,
Hu Tao


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]