mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 23:03:54 -06:00
QemuOpts: change opt->name|str from (const char *) to (char *)
qemu_opt_del() already assumes that all QemuOpt instances contain malloc'd name and value; but it had to cast away const because opts_start_struct() was doing its own thing and using static storage instead. By using the correct type and malloced strings everywhere, the usage of this struct becomes clearer. Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Leandro Dorileo <l@dorileo.org> Signed-off-by: Chunyan Liu <cyliu@suse.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
e36af94f86
commit
dc8622f2bf
3 changed files with 11 additions and 7 deletions
|
@ -664,8 +664,8 @@ static void qemu_opt_parse(QemuOpt *opt, Error **errp)
|
|||
static void qemu_opt_del(QemuOpt *opt)
|
||||
{
|
||||
QTAILQ_REMOVE(&opt->opts->head, opt, next);
|
||||
g_free((/* !const */ char*)opt->name);
|
||||
g_free((/* !const */ char*)opt->str);
|
||||
g_free(opt->name);
|
||||
g_free(opt->str);
|
||||
g_free(opt);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue