loader: extract rom_free() function
commite7f59933548097dbb2272c49f2e0a4ece92697ff
authorStefan Hajnoczi <stefanha@redhat.com>
Thu, 16 Aug 2018 13:05:28 +0000 (16 14:05 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 16 Aug 2018 13:05:28 +0000 (16 14:05 +0100)
tree95086f59e1cd56e347a81e863c4c4e8507c43b98
parent191776b96a381b5d2b8d3f90c1c02b3e4779e5f7
loader: extract rom_free() function

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 a no-op.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20180814162739.11814-4-stefanha@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/core/loader.c