From: Ruben Kerkhof Date: Tue, 4 Sep 2018 10:48:12 +0000 (+0200) Subject: virt plugin: fix segfault on error path X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=8d7efd7ed624c54f5b0aed5d961394bd7a145426;p=collectd.git 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. --- 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. */