aboutsummaryrefslogtreecommitdiff
path: root/include/hw/qdev-core.h
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2024-10-08 17:47:05 +0100
committerKevin Wolf <kwolf@redhat.com>2024-10-22 17:52:49 +0200
commit75200708cec2377425e3ca916cc5706ba22c9272 (patch)
treecd926dd4f2e4595490cc516d1cd03d929d84f11d /include/hw/qdev-core.h
parent6f625ce2f21d6a1243065d236298277c56f972d5 (diff)
downloadqemu-75200708cec2377425e3ca916cc5706ba22c9272.zip
qemu-75200708cec2377425e3ca916cc5706ba22c9272.tar.gz
qemu-75200708cec2377425e3ca916cc5706ba22c9272.tar.bz2
block/gluster: Use g_autofree for string in qemu_gluster_parse_json()
In the loop in qemu_gluster_parse_json() we do: char *str = NULL; for(...) { str = g_strdup_printf(...); ... if (various errors) { goto out; } ... g_free(str); str = NULL; } return 0; out: various cleanups; g_free(str); ... return -errno; Coverity correctly complains that the assignment "str = NULL" at the end of the loop is unnecessary, because we will either go back to the top of the loop and overwrite it, or else we will exit the loop and then exit the function without ever reading str again. The assignment is there as defensive coding to ensure that str is only non-NULL if it's a live allocation, so this is intentional. We can make Coverity happier and simplify the code here by using g_autofree, since we never need 'str' outside the loop. Resolves: Coverity CID 1527385 Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20241008164708.2966400-2-peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'include/hw/qdev-core.h')
0 files changed, 0 insertions, 0 deletions