cutils: replace strdup with g_strdup
commit090afdc5e61e80de4ac158fa4cb2a578ee69be54
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 2 Nov 2020 18:19:53 +0000 (2 13:19 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 3 Nov 2020 14:42:52 +0000 (3 09:42 -0500)
tree0aca2491db5e21ae98dcac2fcf6c4a3e23634e1f
parent83851c7c60c90e9fb6a23ff48076387a77bc33cd
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>
include/qemu/cutils.h
util/cutils.c