oslib: do not call g_strdup from qemu_get_exec_dir

Just return the directory without requiring the caller to free it.
This also removes a bogus check for NULL in os_find_datadir and
module_load_one; g_strdup of a static variable cannot return NULL.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini
2020-08-18 12:11:02 +02:00
parent 05512f55aa
commit a4c13869f9
7 changed files with 20 additions and 27 deletions

View File

@ -65,7 +65,7 @@ void os_setup_early_signal_handling(void)
*/
char *os_find_datadir(void)
{
return qemu_get_exec_dir();
return g_strdup(qemu_get_exec_dir());
}
void os_set_line_buffering(void)