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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to