AVR patches

Fixes a memory leak reported by Coverity (CID 1430449).
 
 CI jobs result:
 . https://gitlab.com/philmd/qemu/-/pipelines/168722631
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAl8XLSMACgkQ4+MsLN6t
 wN569RAA2BBXXS/eMV9lrr9B+l0nG6WNlS7L64ltab/TmKhQSJqwzR4MfV5tlA+T
 oGGZ1gSr73cOi11kpgtksCG9JpIp8XsJTx2OwNi9RxGxH7q/vK8TYR3evNfGaU9x
 3JK/IT4TltNcyLmmR7fITbH0awygIKGXMa/zn+SvqK/mdD+bGWpE5ZsMbcjBNhC/
 zgJ4zbsgMmV+9QKU7ezNzNPwH1yIbE9TRzhi4UkvcFNIOoxfMmPxyVSqAufd1g1h
 sRQjir9aeu7JRPXFaIOyQrbWm6XwnQyyCJnOWzaFGy7xTQEbYh7LzLopeiEixS6p
 pjbrds/SNKtRMEQ+PLUMdA805uGbDoYbc8k/EL17KlElg+0EfMNu9DTDswrwzPNr
 LDXDvVuxE9oMgDooJrETAvpfQAqghJnHnFAWLX5SmdyGZSslooLLmUmHqHhcvNOd
 vdYGX8T2NBjBo6/36/fJGaNwwn1RjBZRP6wGUt+rjc7M7BGd8VrZrhWBi/H+YS39
 YcdtlMbJfSK37EiYC9KcIIwj3+FGJ9J4gowc5MCDZS+9fPintzFNhQOKrDGtMmzl
 gdeVPoB3kecCNNoDJWPgIo2JzXlkMEjFHeN5w2CqVMwQHe3UIuU82q6flVIT1JOT
 YaCZZqgz3Qb3HqKdgRfDw6DxJx7h0e2H0eyXfCMfqGGE/kffLGI=
 =HVzO
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/philmd-gitlab/tags/avr-20200721' into staging

AVR patches

Fixes a memory leak reported by Coverity (CID 1430449).

CI jobs result:
. https://gitlab.com/philmd/qemu/-/pipelines/168722631

# gpg: Signature made Tue 21 Jul 2020 19:00:03 BST
# gpg:                using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full]
# Primary key fingerprint: FAAB E75E 1291 7221 DCFD  6BB2 E3E3 2C2C DEAD C0DE

* remotes/philmd-gitlab/tags/avr-20200721:
  hw/avr/boot: Fix memory leak in avr_load_firmware()
  qemu-common: Document qemu_find_file()
  qemu/osdep: Reword qemu_get_exec_dir() documentation
  qemu/osdep: Document os_find_datadir() return value

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2020-07-23 11:43:25 +01:00
commit 53ce7b47b5
5 changed files with 31 additions and 3 deletions

View file

@ -60,7 +60,7 @@ static const char *avr_elf_e_flags_to_cpu_type(uint32_t flags)
bool avr_load_firmware(AVRCPU *cpu, MachineState *ms,
MemoryRegion *program_mr, const char *firmware)
{
const char *filename;
g_autofree char *filename = NULL;
int bytes_loaded;
uint64_t entry;
uint32_t e_flags;

View file

@ -110,6 +110,23 @@ const char *qemu_get_vm_name(void);
#define QEMU_FILE_TYPE_BIOS 0
#define QEMU_FILE_TYPE_KEYMAP 1
/**
* qemu_find_file:
* @type: QEMU_FILE_TYPE_BIOS (for BIOS, VGA BIOS)
* or QEMU_FILE_TYPE_KEYMAP (for keymaps).
* @name: Relative or absolute file name
*
* If @name exists on disk as an absolute path, or a path relative
* to the current directory, then returns @name unchanged.
* Otherwise searches for @name file in the data directories, either
* configured at build time (DATADIR) or registered with the -L command
* line option.
*
* The caller must use g_free() to free the returned data when it is
* no longer required.
*
* Returns: a path that can access @name, or NULL if no matching file exists.
*/
char *qemu_find_file(int type, const char *name);
/* OS specific functions */

View file

@ -588,7 +588,10 @@ char *qemu_get_local_state_pathname(const char *relative_pathname);
void qemu_init_exec_dir(const char *argv0);
/* Get the saved exec dir.
* Caller needs to release the returned string by g_free() */
*
* The caller is responsible for releasing the value returned with g_free()
* after use.
*/
char *qemu_get_exec_dir(void);
/**

View file

@ -84,6 +84,9 @@ void os_setup_signal_handling(void)
* Find a likely location for support files using the location of the binary.
* When running from the build tree this will be "$bindir/../pc-bios".
* Otherwise, this is CONFIG_QEMU_DATADIR.
*
* The caller must use g_free() to free the returned data when it is
* no longer required.
*/
char *os_find_datadir(void)
{

View file

@ -57,7 +57,12 @@ void os_setup_early_signal_handling(void)
atexit(os_undo_timer_resolution);
}
/* Look for support files in the same directory as the executable. */
/*
* Look for support files in the same directory as the executable.
*
* The caller must use g_free() to free the returned data when it is
* no longer required.
*/
char *os_find_datadir(void)
{
return qemu_get_exec_dir();