If srv->workers is a NULL pointer, as it is the case if there are no workers, then don't try to dereference it. Signed-off-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxx> Reviewed-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxx> --- src/rpc/virnetserver.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c index 5ae809e372..be6f610880 100644 --- a/src/rpc/virnetserver.c +++ b/src/rpc/virnetserver.c @@ -933,13 +933,21 @@ virNetServerGetThreadPoolParameters(virNetServerPtr srv, size_t *jobQueueDepth) { virObjectLock(srv); - - *minWorkers = virThreadPoolGetMinWorkers(srv->workers); - *maxWorkers = virThreadPoolGetMaxWorkers(srv->workers); - *freeWorkers = virThreadPoolGetFreeWorkers(srv->workers); - *nWorkers = virThreadPoolGetCurrentWorkers(srv->workers); - *nPrioWorkers = virThreadPoolGetPriorityWorkers(srv->workers); - *jobQueueDepth = virThreadPoolGetJobQueueDepth(srv->workers); + if (srv->workers) { + *minWorkers = virThreadPoolGetMinWorkers(srv->workers); + *maxWorkers = virThreadPoolGetMaxWorkers(srv->workers); + *freeWorkers = virThreadPoolGetFreeWorkers(srv->workers); + *nWorkers = virThreadPoolGetCurrentWorkers(srv->workers); + *nPrioWorkers = virThreadPoolGetPriorityWorkers(srv->workers); + *jobQueueDepth = virThreadPoolGetJobQueueDepth(srv->workers); + } else { + *minWorkers = 0; + *maxWorkers = 0; + *freeWorkers = 0; + *nWorkers = 0; + *nPrioWorkers = 0; + *jobQueueDepth = 0; + } virObjectUnlock(srv); return 0; -- 2.13.6 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list