Patchwork [v2,11/11] qemu-ga: Fix unchecked strdup() by converting to g_strdup()

login
register
mail settings
Submitter Markus Armbruster
Date Jan. 16, 2013, 5:32 p.m.
Message ID <1358357540-29862-12-git-send-email-armbru@redhat.com>
Download mbox | patch
Permalink /patch/212986/
State New
Headers show

Comments

Markus Armbruster - Jan. 16, 2013, 5:32 p.m.
I figure it's freed somewhere deep down in QAPI, with g_free().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
 qga/commands.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/qga/commands.c b/qga/commands.c
index 7ffb35e..528b082 100644
--- a/qga/commands.c
+++ b/qga/commands.c
@@ -61,7 +61,7 @@  struct GuestAgentInfo *qmp_guest_info(Error **err)
 
     while (*cmd_list) {
         cmd_info = g_malloc0(sizeof(GuestAgentCommandInfo));
-        cmd_info->name = strdup(*cmd_list);
+        cmd_info->name = g_strdup(*cmd_list);
         cmd_info->enabled = qmp_command_is_enabled(cmd_info->name);
 
         cmd_info_list = g_malloc0(sizeof(GuestAgentCommandInfoList));