summaryrefslogtreecommitdiffstats
path: root/include/qemu
diff options
context:
space:
mode:
authorPaolo Bonzini2020-11-02 19:19:53 +0100
committerPaolo Bonzini2020-11-03 15:42:52 +0100
commit090afdc5e61e80de4ac158fa4cb2a578ee69be54 (patch)
tree0aca2491db5e21ae98dcac2fcf6c4a3e23634e1f /include/qemu
parentMerge remote-tracking branch 'remotes/mdroth/tags/qga-pull-2020-10-27-v3-tag'... (diff)
downloadqemu-090afdc5e61e80de4ac158fa4cb2a578ee69be54.tar.gz
qemu-090afdc5e61e80de4ac158fa4cb2a578ee69be54.tar.xz
qemu-090afdc5e61e80de4ac158fa4cb2a578ee69be54.zip
cutils: replace strdup with g_strdup
Memory returned by get_relocated_path must be freed with free or g_free depending on the path that the function took; Coverity takes exception to this practice. The fix lets caller use g_free as is standard in QEMU. While at it, mention the requirements on the caller in the doc comment. Suggested-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/qemu')
-rw-r--r--include/qemu/cutils.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/qemu/cutils.h b/include/qemu/cutils.h
index 4bbf4834ea..986ed8e15f 100644
--- a/include/qemu/cutils.h
+++ b/include/qemu/cutils.h
@@ -205,6 +205,7 @@ int qemu_pstrcmp0(const char **str1, const char **str2);
* as the prefix. For example, if `bindir` is `/usr/bin` and @dir is
* `/usr/share/qemu`, the function will append `../share/qemu` to the
* directory that contains the running executable and return the result.
+ * The returned string should be freed by the caller.
*/
char *get_relocated_path(const char *dir);