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

@ -597,12 +597,8 @@ char *qemu_get_local_state_pathname(const char *relative_pathname);
* Try OS specific API first, if not working, parse from argv0. */
void qemu_init_exec_dir(const char *argv0);
/* Get the saved exec dir.
*
* The caller is responsible for releasing the value returned with g_free()
* after use.
*/
char *qemu_get_exec_dir(void);
/* Get the saved exec dir. */
const char *qemu_get_exec_dir(void);
/**
* qemu_getauxval: