#include "qmp-commands.h"
#include "fsdev/qemu-fsdev.h"
+#include "emulator.h"
#include "emulator_options.h"
#include "hw/virtio/maru_virtio_touchscreen.h"
#include "hw/virtio/maru_virtio_evdi.h"
// bin path
// only set by osutil-{OS}.c when start up
-const char *bin_path = "";
+const char *bin_path = NULL;
const char *get_bin_path(void)
{
- return bin_path;
+ if (bin_path) {
+ return bin_path;
+ }
+
+ return "";
}
// emulator kernel log file
-static const char *kernel_log_redirect_file;
+static const char *kernel_log_redirect_file = NULL;
const char *get_kernel_log_redirect_file(void)
{
}
// emulator log file
-static const char *log_redirect_file;
+static const char *log_redirect_file = NULL;
#ifdef CONFIG_WIN32
// for checking Windows version
g_strfreev(token);
}
- http_proxy_addr = "";
+ http_proxy_addr = g_strdup("");
LOG_INFO("HTTP proxy address is not set.\n");
return skin_enabled;
}
#endif
+
+static void emul_state_notify_exit(Notifier *notifier, void *data)
+{
+ g_free((void *)launch_conf_file);
+ launch_conf_file = NULL;
+
+ g_free((void *)bin_path);
+ bin_path = NULL;
+
+ g_free((void *)kernel_log_redirect_file);
+ kernel_log_redirect_file = NULL;
+
+ g_free((void *)log_redirect_file);
+ log_redirect_file = NULL;
+
+ g_free((void *)drive_image_file);
+ drive_image_file = NULL;
+
+ g_free((void *)http_proxy_addr);
+ http_proxy_addr = NULL;
+
+ g_free((void *)vm_name);
+ vm_name = NULL;
+
+ g_free((void *)vm_data_path);
+ vm_data_path = NULL;
+}
+
+static Notifier emul_state_exit = { .notify = emul_state_notify_exit };
+
+void init_emul_state(void)
+{
+ emulator_add_exit_notifier(&emul_state_exit);
+}