Coverity found a memory leak...
<...snip...>
> int
> virSCSIDeviceSetUsedBy(virSCSIDevicePtr dev,
> - const char *name)
> + const char *drvname,
> + const char *domname)
> {
> - char *copy = NULL;
> -
> - if (VIR_STRDUP(copy, name) < 0)
> + virUsedByInfoPtr copy;
> + if (VIR_ALLOC(copy) < 0)
> + return -1;
> + if (VIR_STRDUP(copy->drvname, drvname) < 0)
> + return -1;
> + if (VIR_STRDUP(copy->domname, domname) < 0)
> return -1;
Either/both VIR_STRDUP() failures of return -1 will leak 'copy'.
John
--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list