OSDN Git Service

qemu-ga: Fix unchecked strdup() by converting to g_strdup()
authorMarkus Armbruster <armbru@redhat.com>
Tue, 22 Jan 2013 10:08:06 +0000 (11:08 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Wed, 30 Jan 2013 10:14:46 +0000 (11:14 +0100)
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>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
qga/commands.c

index 7ffb35e..528b082 100644 (file)
@@ -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));