aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2020-08-18 12:11:02 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2020-09-30 19:11:36 +0200
commita4c13869f95cb45d657cc1df3803f633221d4971 (patch)
tree8ebf036c107ff7aad647eb31d070fafe7115bb82 /tests
parent05512f55aaca92505b75d8fa6818b088a5eeb07f (diff)
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>
Diffstat (limited to 'tests')
-rw-r--r--tests/qtest/fuzz/fuzz.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/qtest/fuzz/fuzz.c b/tests/qtest/fuzz/fuzz.c
index 7f266ffc63..d3a3ccdec9 100644
--- a/tests/qtest/fuzz/fuzz.c
+++ b/tests/qtest/fuzz/fuzz.c
@@ -143,7 +143,8 @@ int LLVMFuzzerInitialize(int *argc, char ***argv, char ***envp)
{
char *target_name;
- char *bindir, *datadir;
+ const char *bindir;
+ char *datadir;
bool serialize = false;
/* Initialize qgraph and modules */
@@ -166,7 +167,6 @@ int LLVMFuzzerInitialize(int *argc, char ***argv, char ***envp)
*/
bindir = g_path_get_dirname(**argv);
datadir = g_build_filename(bindir, "pc-bios", NULL);
- g_free(bindir);
if (g_file_test(datadir, G_FILE_TEST_IS_DIR)) {
qemu_add_data_dir(datadir);
}