Re: [Qemu-devel] [PATCH v4 3/6] loader: extract rom_free() function

2018-08-08 Thread Alistair Francis
On Fri, Aug 3, 2018 at 7:47 AM, Stefan Hajnoczi wrote: > The next patch will need to free a rom. There is already code to do > this in rom_add_file(). > > Note that rom_add_file() uses: > > rom = g_malloc0(sizeof(*rom)); > ... > if (rom->fw_dir) { > g_free(rom->fw_dir); > g_free

[Qemu-devel] [PATCH v4 3/6] loader: extract rom_free() function

2018-08-03 Thread Stefan Hajnoczi
The next patch will need to free a rom. There is already code to do this in rom_add_file(). Note that rom_add_file() uses: rom = g_malloc0(sizeof(*rom)); ... if (rom->fw_dir) { g_free(rom->fw_dir); g_free(rom->fw_file); } The conditional is unnecessary since g_free(NULL) is