return -1;
}
- virTypedParameterPtr params = calloc((size_t)nparams, sizeof(*params));
+ virTypedParameterPtr params = calloc(nparams, sizeof(*params));
if (params == NULL) {
ERROR("virt plugin: alloc(%i) for block=%s parameters failed.", nparams,
path);
int max_cpus = VIR_NODEINFO_MAXCPUS(nodeinfo);
int cpu_map_len = VIR_CPU_MAPLEN(max_cpus);
- virVcpuInfoPtr vinfo = calloc(nr_virt_cpu, sizeof(vinfo[0]));
+ virVcpuInfoPtr vinfo = calloc(nr_virt_cpu, sizeof(*vinfo));
if (vinfo == NULL) {
ERROR(PLUGIN_NAME " plugin: calloc failed.");
return -1;
return -1;
}
- virTypedParameterPtr param = calloc(nparams, sizeof(virTypedParameter));
+ virTypedParameterPtr param = calloc(nparams, sizeof(*param));
if (param == NULL) {
ERROR(PLUGIN_NAME " plugin: alloc(%i) for cpu parameters failed.", nparams);
return -1;
static int get_memory_stats(virDomainPtr domain) {
virDomainMemoryStatPtr minfo =
- calloc(VIR_DOMAIN_MEMORY_STAT_NR, sizeof(virDomainMemoryStatStruct));
+ calloc(VIR_DOMAIN_MEMORY_STAT_NR, sizeof(*minfo));
if (minfo == NULL) {
- ERROR("virt plugin: malloc failed.");
+ ERROR("virt plugin: calloc failed.");
return -1;
}