aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2021-11-09 17:05:18 +0100
committerRichard Henderson <richard.henderson@linaro.org>2021-11-09 17:05:18 +0100
commit3871cfce1ef53db3cfa71f610300da237ca4632c (patch)
tree1609f3760d6c37a5caa6db94844e91c9f818ccaa
parent2b22e7540d6ab4efe82d442363e3fc900cea6584 (diff)
parent5db83c7e90ec6c0b28995b537bb03942edcd4164 (diff)
Merge tag 'q800-for-6.2-pull-request' of git://github.com/vivier/qemu-m68k into staging
Fix CID 1465231 # gpg: Signature made Tue 09 Nov 2021 04:46:03 PM CET # gpg: using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C # gpg: issuer "laurent@vivier.eu" # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full] # gpg: aka "Laurent Vivier <laurent@vivier.eu>" [full] # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full] * tag 'q800-for-6.2-pull-request' of git://github.com/vivier/qemu-m68k: macfb: fix a memory leak (CID 1465231) Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r--hw/display/macfb.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/hw/display/macfb.c b/hw/display/macfb.c
index 4b352eb89c..277d3e6633 100644
--- a/hw/display/macfb.c
+++ b/hw/display/macfb.c
@@ -440,21 +440,18 @@ static MacFbMode *macfb_find_mode(MacfbDisplayType display_type,
static gchar *macfb_mode_list(void)
{
- gchar *list = NULL;
- gchar *mode;
+ GString *list = g_string_new("");
MacFbMode *macfb_mode;
int i;
for (i = 0; i < ARRAY_SIZE(macfb_mode_table); i++) {
macfb_mode = &macfb_mode_table[i];
- mode = g_strdup_printf(" %dx%dx%d\n", macfb_mode->width,
+ g_string_append_printf(list, " %dx%dx%d\n", macfb_mode->width,
macfb_mode->height, macfb_mode->depth);
- list = g_strconcat(mode, list, NULL);
- g_free(mode);
}
- return list;
+ return g_string_free(list, FALSE);
}
@@ -643,7 +640,7 @@ static bool macfb_common_realize(DeviceState *dev, MacfbState *s, Error **errp)
gchar *list;
error_setg(errp, "unknown display mode: width %d, height %d, depth %d",
s->width, s->height, s->depth);
- list = macfb_mode_list();
+ list = macfb_mode_list();
error_append_hint(errp, "Available modes:\n%s", list);
g_free(list);