Skip to content

Commit

Permalink
HMP: Initialize err before using
Browse files Browse the repository at this point in the history
When bdrv_snapshot_delete return fail, the errp will not be
assigned a valid value in error_propagate as errp didn't be
initialized in hmp_delvm, then error_reportf_err will use an
uninitialized value(call by hmp_delvm), and qemu crash.

Signed-off-by: zhangjixiang <jixiang_zhang@h3c.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
  • Loading branch information
zhangjixiang authored and dagrh committed Mar 20, 2018
1 parent 4bdc24f commit 32cd655
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hmp.c
Expand Up @@ -1321,7 +1321,7 @@ void hmp_savevm(Monitor *mon, const QDict *qdict)
void hmp_delvm(Monitor *mon, const QDict *qdict)
{
BlockDriverState *bs;
Error *err;
Error *err = NULL;
const char *name = qdict_get_str(qdict, "name");

if (bdrv_all_delete_snapshot(name, &bs, &err) < 0) {
Expand Down

0 comments on commit 32cd655

Please sign in to comment.