vmspawn: drop "const" from string we free
I am a bit surprised this compiled at all...
This commit is contained in:
@@ -639,7 +639,12 @@ static int cmdline_add_vsock(char ***cmdline, int vsock_fd) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int start_tpm(sd_bus *bus, const char *scope, const char *tpm, const char **ret_state_tempdir) {
|
||||
static int start_tpm(
|
||||
sd_bus *bus,
|
||||
const char *scope,
|
||||
const char *swtpm,
|
||||
char **ret_state_tempdir) {
|
||||
|
||||
_cleanup_(rm_rf_physical_and_freep) char *state_dir = NULL;
|
||||
_cleanup_free_ char *scope_prefix = NULL;
|
||||
_cleanup_(socket_service_pair_done) SocketServicePair ssp = {
|
||||
@@ -649,7 +654,7 @@ static int start_tpm(sd_bus *bus, const char *scope, const char *tpm, const char
|
||||
|
||||
assert(bus);
|
||||
assert(scope);
|
||||
assert(tpm);
|
||||
assert(swtpm);
|
||||
assert(ret_state_tempdir);
|
||||
|
||||
r = unit_name_to_prefix(scope, &scope_prefix);
|
||||
@@ -674,7 +679,7 @@ static int start_tpm(sd_bus *bus, const char *scope, const char *tpm, const char
|
||||
if (!ssp.listen_address)
|
||||
return log_oom();
|
||||
|
||||
ssp.exec_start = strv_new(tpm, "socket", "--tpm2", "--tpmstate");
|
||||
ssp.exec_start = strv_new(swtpm, "socket", "--tpm2", "--tpmstate");
|
||||
if (!ssp.exec_start)
|
||||
return log_oom();
|
||||
|
||||
@@ -691,7 +696,6 @@ static int start_tpm(sd_bus *bus, const char *scope, const char *tpm, const char
|
||||
return r;
|
||||
|
||||
*ret_state_tempdir = TAKE_PTR(state_dir);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1457,7 +1461,7 @@ static int run_virtual_machine(int kvm_device_fd, int vhost_device_fd) {
|
||||
}
|
||||
}
|
||||
|
||||
_cleanup_free_ const char *tpm_state_tempdir = NULL;
|
||||
_cleanup_free_ char *tpm_state_tempdir = NULL;
|
||||
if (swtpm) {
|
||||
_cleanup_free_ char *escaped_state_dir = NULL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user