The string needs be be freed with g_free() according to the functions
documentation.
Coverity: CID
1642762
Fixes: f62226f7dc44 ("hw/core/loader: improve error handling in image loading functions")
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <
20251030015306.
2279148-3-alistair.francis@wdc.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
}
if (size > max_sz) {
+ char *size_str = size_to_str(max_sz);
+
error_setg(errp, "%s exceeds maximum image size (%s)",
- filename, size_to_str(max_sz));
+ filename, size_str);
+
+ g_free(size_str);
return -1;
}