X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Flibvirt.c;h=4cbe38d2c1f8a05d9fabd43a48c8dbb64c89c106;hb=f0b9430b0c0f45ada6f655dd4b9c64a8cbdf8d66;hp=87b71e698b93c894a3c4cdabde0e218144ed083d;hpb=b61a03b05c1f4040a6599334b65141aa3bd134f5;p=collectd.git diff --git a/src/libvirt.c b/src/libvirt.c index 87b71e69..4cbe38d2 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -259,8 +259,8 @@ lv_init (void) { if (virInitialize () != 0) return -1; - - return 0; + else + return 0; } static int @@ -798,6 +798,9 @@ add_interface_device (virDomainPtr dom, const char *path, const char *address, u int new_size = sizeof (interface_devices[0]) * (nr_interface_devices+1); char *path_copy, *address_copy, number_string[15]; + if ((path == NULL) || (address == NULL)) + return EINVAL; + path_copy = strdup (path); if (!path_copy) return -1; @@ -833,6 +836,9 @@ ignore_device_match (ignorelist_t *il, const char *domname, const char *devpath) char *name; int n, r; + if ((domname == NULL) || (devpath == NULL)) + return 0; + n = sizeof (char) * (strlen (domname) + strlen (devpath) + 2); name = malloc (n); if (name == NULL) {