vmspawn: don't leak prior arg_directory in ephemeral branch
The ephemeral-snapshot branch did a bare arg_directory = strdup(...), orphaning the -D/--directory allocation from parse_argv. Use free_and_strdup(), matching the idiom already used elsewhere in the file. Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Paul Meyer <katexochen0@gmail.com>
This commit is contained in:
@@ -3172,8 +3172,8 @@ static int run_virtual_machine(int kvm_device_fd, int vhost_device_fd) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to create ephemeral snapshot of '%s': %m", arg_directory);
|
||||
|
||||
arg_directory = strdup(snapshot_directory);
|
||||
if (!arg_directory)
|
||||
r = free_and_strdup(&arg_directory, snapshot_directory);
|
||||
if (r < 0)
|
||||
return log_oom();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user