mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
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:
parent
05512f55aa
commit
a4c13869f9
7 changed files with 20 additions and 27 deletions
|
@ -366,7 +366,9 @@ void qemu_init_exec_dir(const char *argv0)
|
|||
char *p = NULL;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
assert(!exec_dir[0]);
|
||||
if (exec_dir[0]) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(__linux__)
|
||||
{
|
||||
|
@ -439,9 +441,9 @@ void qemu_init_exec_dir(const char *argv0)
|
|||
g_free(dir);
|
||||
}
|
||||
|
||||
char *qemu_get_exec_dir(void)
|
||||
const char *qemu_get_exec_dir(void)
|
||||
{
|
||||
return g_strdup(exec_dir);
|
||||
return exec_dir;
|
||||
}
|
||||
|
||||
static void sigbus_handler(int signal)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue