From 8d7efd7ed624c54f5b0aed5d961394bd7a145426 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Tue, 4 Sep 2018 12:48:12 +0200 Subject: [PATCH] virt plugin: fix segfault on error path The libvirt plugin refreshes its list of domains every RefreshInterval seconds. If a domain crashes after getting the list, getting the stats for its block devices returns an error. We then try to call virDomainGetName on an invalid pointer. Fix this. --- src/virt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/virt.c b/src/virt.c index 174db2fa..39165bcf 100644 --- a/src/virt.c +++ b/src/virt.c @@ -1636,7 +1636,7 @@ static int lv_read(user_data_t *ud) { ERROR(PLUGIN_NAME " failed to get stats for block device (%s) in domain %s", state->block_devices[i].path, - virDomainGetName(state->domains[i].ptr)); + virDomainGetName(state->block_devices[i].dom)); } /* Get interface stats for each domain. */ -- 2.11.0