mirror of https://github.com/xemu-project/xemu.git
net: do not use atexit for cleanup
This will be necessary in the next patch, which stops using atexit for character devices; without it, vhost-user and the redirector filter will cause a use-after-free. Relying on the ordering of atexit calls is also brittle, even now that both the network and chardev subsystems are using atexit. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
f6c2e66ae8
commit
8caf911d33
5
vl.c
5
vl.c
|
@ -4345,9 +4345,6 @@ int main(int argc, char **argv, char **envp)
|
||||||
qemu_opts_del(icount_opts);
|
qemu_opts_del(icount_opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clean up network at qemu process termination */
|
|
||||||
atexit(&net_cleanup);
|
|
||||||
|
|
||||||
if (default_net) {
|
if (default_net) {
|
||||||
QemuOptsList *net = qemu_find_opts("net");
|
QemuOptsList *net = qemu_find_opts("net");
|
||||||
qemu_opts_set(net, NULL, "type", "nic", &error_abort);
|
qemu_opts_set(net, NULL, "type", "nic", &error_abort);
|
||||||
|
@ -4611,5 +4608,7 @@ int main(int argc, char **argv, char **envp)
|
||||||
tpm_cleanup();
|
tpm_cleanup();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
net_cleanup();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue