mirror of
https://github.com/mborgerson/xemu.git
synced 2025-12-01 16:10:01 +00:00
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>
This commit is contained in:
@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user