Detected by Coverity. The only way to get to error_unlink is if
path was successfully assigned, so the if was useless. Meanwhile,
there was a return statement that did not free path.
* src/locking/lock_driver_sanlock.c
(virLockManagerSanlockSetupLockspace): Fix mem-leak, and drop
useless if.
virReportSystemError(-rv,
_("Unable to add lockspace %s"),
path);
- return -1;
+ goto error_unlink;
} else {
VIR_DEBUG("Lockspace %s is already registered", path);
}
return 0;
error_unlink:
- if (path)
- unlink(path);
+ unlink(path);
error:
VIR_FORCE_CLOSE(fd);
VIR_FREE(path);