aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/security/security_selinux.c7
-rw-r--r--src/storage/storage_backend.c2
2 files changed, 5 insertions, 4 deletions
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index 996177ac0..2a4517207 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -239,7 +239,7 @@ SELinuxReserveSecurityLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
}
ctx = context_new(pctx);
- VIR_FREE(pctx);
+ freecon(pctx);
if (!ctx)
goto err;
@@ -298,11 +298,12 @@ SELinuxGetSecurityProcessLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
_("security label exceeds "
"maximum length: %d"),
VIR_SECURITY_LABEL_BUFLEN - 1);
+ freecon(ctx);
return -1;
}
strcpy(sec->label, (char *) ctx);
- VIR_FREE(ctx);
+ freecon(ctx);
sec->enforcing = security_getenforce();
if (sec->enforcing == -1) {
@@ -387,7 +388,7 @@ SELinuxRestoreSecurityFileLabel(const char *path)
}
err:
- VIR_FREE(fcon);
+ freecon(fcon);
VIR_FREE(newpath);
return rc;
}
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index a6ee56451..10ea33c13 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -1148,11 +1148,11 @@ virStorageBackendUpdateVolTargetInfoFD(virStorageVolTargetPtr target,
}
} else {
target->perms.label = strdup(filecon);
+ freecon(filecon);
if (target->perms.label == NULL) {
virReportOOMError();
return -1;
}
- freecon(filecon);
}
#else
target->perms.label = NULL;