File tree Expand file tree Collapse file tree 5 files changed +31
-3
lines changed Expand file tree Collapse file tree 5 files changed +31
-3
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ static const char *avr_elf_e_flags_to_cpu_type(uint32_t flags)
60
60
bool avr_load_firmware (AVRCPU * cpu , MachineState * ms ,
61
61
MemoryRegion * program_mr , const char * firmware )
62
62
{
63
- const char * filename ;
63
+ g_autofree char * filename = NULL ;
64
64
int bytes_loaded ;
65
65
uint64_t entry ;
66
66
uint32_t e_flags ;
Original file line number Diff line number Diff line change @@ -110,6 +110,23 @@ const char *qemu_get_vm_name(void);
110
110
111
111
#define QEMU_FILE_TYPE_BIOS 0
112
112
#define QEMU_FILE_TYPE_KEYMAP 1
113
+ /**
114
+ * qemu_find_file:
115
+ * @type: QEMU_FILE_TYPE_BIOS (for BIOS, VGA BIOS)
116
+ * or QEMU_FILE_TYPE_KEYMAP (for keymaps).
117
+ * @name: Relative or absolute file name
118
+ *
119
+ * If @name exists on disk as an absolute path, or a path relative
120
+ * to the current directory, then returns @name unchanged.
121
+ * Otherwise searches for @name file in the data directories, either
122
+ * configured at build time (DATADIR) or registered with the -L command
123
+ * line option.
124
+ *
125
+ * The caller must use g_free() to free the returned data when it is
126
+ * no longer required.
127
+ *
128
+ * Returns: a path that can access @name, or NULL if no matching file exists.
129
+ */
113
130
char * qemu_find_file (int type , const char * name );
114
131
115
132
/* OS specific functions */
Original file line number Diff line number Diff line change @@ -588,7 +588,10 @@ char *qemu_get_local_state_pathname(const char *relative_pathname);
588
588
void qemu_init_exec_dir (const char * argv0 );
589
589
590
590
/* Get the saved exec dir.
591
- * Caller needs to release the returned string by g_free() */
591
+ *
592
+ * The caller is responsible for releasing the value returned with g_free()
593
+ * after use.
594
+ */
592
595
char * qemu_get_exec_dir (void );
593
596
594
597
/**
Original file line number Diff line number Diff line change @@ -84,6 +84,9 @@ void os_setup_signal_handling(void)
84
84
* Find a likely location for support files using the location of the binary.
85
85
* When running from the build tree this will be "$bindir/../pc-bios".
86
86
* Otherwise, this is CONFIG_QEMU_DATADIR.
87
+ *
88
+ * The caller must use g_free() to free the returned data when it is
89
+ * no longer required.
87
90
*/
88
91
char * os_find_datadir (void )
89
92
{
Original file line number Diff line number Diff line change @@ -57,7 +57,12 @@ void os_setup_early_signal_handling(void)
57
57
atexit (os_undo_timer_resolution );
58
58
}
59
59
60
- /* Look for support files in the same directory as the executable. */
60
+ /*
61
+ * Look for support files in the same directory as the executable.
62
+ *
63
+ * The caller must use g_free() to free the returned data when it is
64
+ * no longer required.
65
+ */
61
66
char * os_find_datadir (void )
62
67
{
63
68
return qemu_get_exec_dir ();
You can’t perform that action at this time.
0 commit comments