mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 01:43:23 +00:00
Don't call regfree() if regcomp() fails
POSIX states that the preg parameter to regcomp() is undefined on failure, so no need to call regfree() in these cases. http://pubs.opengroup.org/onlinepubs/009695399/functions/regcomp.html See also a discussion on the libvirt dev list https://www.redhat.com/archives/libvir-list/2013-September/msg00262.html
This commit is contained in:
parent
12509c7999
commit
8818376889
@ -1579,7 +1579,7 @@ virStorageBackendRunProgRegex(virStoragePoolObjPtr pool,
|
||||
regerror(err, ®[i], error, sizeof(error));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to compile regex %s"), error);
|
||||
for (j = 0; j <= i; j++)
|
||||
for (j = 0; j < i; j++)
|
||||
regfree(®[j]);
|
||||
VIR_FREE(reg);
|
||||
return -1;
|
||||
|
@ -195,7 +195,6 @@ virStorageBackendLogicalMakeVol(virStoragePoolObjPtr pool,
|
||||
if (err != 0) {
|
||||
char error[100];
|
||||
regerror(err, reg, error, sizeof(error));
|
||||
regfree(reg);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to compile regex %s"),
|
||||
error);
|
||||
|
@ -1787,7 +1787,6 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
|
||||
if (errcode != 0) {
|
||||
char error[100];
|
||||
regerror(errcode, &flags_hvm_rec, error, sizeof(error));
|
||||
regfree(&flags_hvm_rec);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", error);
|
||||
return -1;
|
||||
}
|
||||
@ -1795,7 +1794,6 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
|
||||
if (errcode != 0) {
|
||||
char error[100];
|
||||
regerror(errcode, &flags_pae_rec, error, sizeof(error));
|
||||
regfree(&flags_pae_rec);
|
||||
regfree(&flags_hvm_rec);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", error);
|
||||
return -1;
|
||||
@ -1804,7 +1802,6 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
|
||||
if (errcode != 0) {
|
||||
char error[100];
|
||||
regerror(errcode, &xen_cap_rec, error, sizeof(error));
|
||||
regfree(&xen_cap_rec);
|
||||
regfree(&flags_pae_rec);
|
||||
regfree(&flags_hvm_rec);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", error);
|
||||
|
Loading…
Reference in New Issue
Block a user